<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Prodhosh Blogs]]></title><description><![CDATA[I'm Prodhosh. I write about the bugs I hit, the tools I build and what I learn along the way: open source, security, Next.js and web development. Real stories, ]]></description><link>https://prodhosh.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6afae352633432277805410c/4e683148-68bd-4344-9d76-7e16776f6768.jpg</url><title>Prodhosh Blogs</title><link>https://prodhosh.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 18 Nov 2026 13:13:27 GMT</lastBuildDate><atom:link href="https://prodhosh.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Check Any Repo for Hidden Malware Before You Run It.]]></title><description><![CDATA[A step by step forkguard guide: clean your computer and GitHub of PolinRider malware, and check AI agent skills before you install them.]]></description><link>https://prodhosh.hashnode.dev/how-to-check-any-repo-for-hidden-malware</link><guid isPermaLink="true">https://prodhosh.hashnode.dev/how-to-check-any-repo-for-hidden-malware</guid><category><![CDATA[Security]]></category><category><![CDATA[GitHub]]></category><category><![CDATA[npm]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Prodhosh VS]]></dc:creator><pubDate>Mon, 16 Nov 2026 11:24:41 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6afae352633432277805410c/84776f6b-4b5b-47c2-996b-10b1322455ae.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In my last post, <a href="https://blog.prodhosh.me/blog/malware-hid-in-my-old-repos-polinrider">Malware Hid in My Old Repos and Git Never Showed It</a>, I wrote about PolinRider. It is the malware that hides past hundreds of spaces at the end of a normal line in <code>postcss.config.mjs</code>, rewrites your commits so git shows nothing, and runs the second you open the folder in VS Code or type <code>npm run dev</code>.</p>
<p>I ended that post saying I was building a CLI to run all those checks for you. It is called <strong>forkguard</strong>, and this post is the full guide: how to check a project, how to clean your computer, how to clean your GitHub, and how to protect yourself from now on. It also covers the new part, because PolinRider is not the only thing going after developers anymore. AI agent skills are the next door, and forkguard checks those too.</p>
<p>It turned out I needed it more than I thought. Two weeks after my first post, PolinRider was back in <strong>35 of my 53 repos</strong>. Cleaning that by hand, carefully, without losing real work, took me a whole day. With forkguard it is a few commands.</p>
<h2>The order that matters</h2>
<p>If you only remember one thing from this post, remember this order:</p>
<ol>
<li><strong>Clean your computer first.</strong> If your machine is infected, anything you clean on GitHub gets infected again the next time you push.</li>
<li><strong>Then clean your GitHub.</strong> Every repo, every branch.</li>
<li><strong>Then change your keys,</strong> from a clean device. The malware steals them.</li>
<li><strong>Then protect yourself,</strong> so it never gets in again.</li>
</ol>
<p>The rest of this post goes through it in that order.</p>
<h2>What you need</h2>
<ul>
<li><strong>Node.js 18 or newer.</strong> Check with <code>node --version</code>.</li>
<li><strong>git.</strong> Check with <code>git --version</code>.</li>
</ul>
<p>That is it. forkguard has zero dependencies, which matters more than it sounds. A tool you run before <code>npm install</code> should not need <code>npm install</code> itself.</p>
<h2>Step 1: Install it</h2>
<pre><code class="language-bash">npm install -g forkguard
</code></pre>
<img src="https://blog.prodhosh.me/media/4/forkguard-install.png" alt="Installing forkguard with npm" style="display:block;margin:0 auto" />

<p>Just want to try it once? Skip the install and put <code>npx</code> in front of any command, like <code>npx forkguard</code>.</p>
<h2>Part 1: Clean your own computer</h2>
<h3>Check a project</h3>
<p>Open a terminal inside any project folder and run:</p>
<pre><code class="language-bash">forkguard
</code></pre>
<p>Run it from the folder that holds all your projects and it checks every project inside, in one go.</p>
<p>If the project is clean, you get one line and you can get on with your day:</p>
<img src="https://blog.prodhosh.me/media/5/forkguard-clean.png" alt="forkguard saying a project looks clean" style="display:block;margin:0 auto" />

<p>If it is not, you get a list of exactly what is wrong and where:</p>
<img src="https://blog.prodhosh.me/media/6/forkguard-infected.png" alt="forkguard finding 8 problems in an infected project" style="display:block;margin:0 auto" />

<p>Every line tells you three things: how serious it is, which file, and what is wrong in plain words.</p>
<ul>
<li><strong>HIGH</strong> means it can run by itself and steal from you. Do not install, run or open the project yet.</li>
<li><strong>MED</strong> means it is worth a look, but it does not run on its own.</li>
</ul>
<p>Look at that list closely, because it is the whole attack from my last post in one screen. The <code>init</code> file and the hidden code in <code>postcss.config.mjs</code> are the payload. The <code>"dev" runs a hidden file called init</code> line is how it starts when you type <code>npm run dev</code>. The VS Code task is how it starts when you just open the folder. The fake font is a loader dressed up as a <code>.ttf</code> file, sitting in a decoy fonts folder so it looks normal.</p>
<h3>Clean it</h3>
<pre><code class="language-bash">forkguard fix
</code></pre>
<img src="https://blog.prodhosh.me/media/8/forkguard-fix.png" alt="forkguard fix cleaning every problem" style="display:block;margin:0 auto" />

<p>Here is the part I am proudest of. Look at the <code>postcss.config.mjs</code> line: <strong>restored your original from git history</strong>.</p>
<p>Cutting out the hidden code is the easy part. The malware also adds fake <code>require</code> lines to the top of files and sometimes even messes with the line breaks. So forkguard looks back through your git history, finds the last clean version of the file, and if the code matches, it puts back your exact original. Byte for byte. When I was cleaning my repos by hand, this was the step that took the longest.</p>
<p>Run it once more to confirm:</p>
<img src="https://blog.prodhosh.me/media/9/forkguard-after.png" alt="forkguard confirming the project is clean again" style="display:block;margin:0 auto" />

<p>Then review the changes with <code>git diff</code> and commit them.</p>
<h3>What it cleans, and what it leaves to you</h3>
<table>
<thead>
<tr>
<th>It finds</th>
<th>What <code>forkguard fix</code> does</th>
</tr>
</thead>
<tbody><tr>
<td>Hidden code at the end of your files</td>
<td>Cuts out only the hidden part and keeps your code</td>
</tr>
<tr>
<td>The hidden <code>init</code> file and the fake font</td>
<td>Deletes them, and the decoy fonts folder</td>
</tr>
<tr>
<td><code>node init &amp;&amp;</code> added to your <code>dev</code>, <code>build</code> and <code>start</code> scripts</td>
<td>Takes it out</td>
</tr>
<tr>
<td>A VS Code task that runs when a folder opens</td>
<td>Removes only that task and keeps your other tasks</td>
</tr>
<tr>
<td>A task hidden inside <code>.vscode/settings.json</code></td>
<td>Removes it and keeps your other settings</td>
</tr>
<tr>
<td>The setting that lets VS Code run tasks by itself</td>
<td>Turns it off</td>
</tr>
<tr>
<td>A <code>.env</code> file git is not ignoring</td>
<td>Adds the rule to <code>.gitignore</code></td>
</tr>
</tbody></table>
<p>Three things need a person, so forkguard tells you instead of guessing: a known bad npm package, a risky install script, and <strong>an infected npm</strong>. That last one is the sneaky one. The malware can replace npm's own <code>cli.js</code>, so every <code>npm</code> command starts it again, even after your projects are clean. forkguard checks npm on your computer every time you run it. If it says npm is infected, reinstall Node.js from <a href="https://nodejs.org">nodejs.org</a> before you run npm again.</p>
<p>One more thing, and I want to be honest about it. While writing this I found a gap. A friend's repo had a task hidden inside <code>.vscode/settings.json</code>, set to run when you open the folder. forkguard called the repo clean. It does not anymore, and the fix is in version 0.8.1. If you scanned something with an older version and it said clean, scan it again.</p>
<h2>Part 2: Clean your GitHub</h2>
<p>Your laptop is clean. Now the malware lives on GitHub too, in your repos and in every branch.</p>
<h3>Log in first (two ways)</h3>
<p>To check and fix your own repos, forkguard needs to talk to GitHub as you. You do not need to log in just to look, because without a login it checks your <strong>public</strong> repos. For private repos and for opening pull requests, pick one.</p>
<p><strong>Option 1: the GitHub CLI.</strong> This is the easy one. Install it, then log in once and click Authorize in the browser:</p>
<pre><code class="language-bash">gh auth login
</code></pre>
<p><strong>Option 2: a token.</strong> If you do not want the CLI, make a personal access token at <a href="https://github.com/settings/personal-access-tokens/new">github.com/settings/personal-access-tokens/new</a>. For checking, read access to your repos is enough. To let forkguard open pull requests, set <strong>Contents</strong> and <strong>Pull requests</strong> to Read and write. Then put it in your terminal, not in a file and never inside the command itself:</p>
<pre><code class="language-bash">export GITHUB_TOKEN=your-token
</code></pre>
<p>On Windows PowerShell it is <code>$env:GITHUB_TOKEN = "your-token"</code>. It only lives in that terminal window, and forkguard never saves or prints it. It also never reads saved passwords or tokens on your computer.</p>
<h3>Check every repo you own</h3>
<p>Remember how the malware got into old repos I had not touched in months? That is the scary part. You cannot check what you do not know about. So forkguard checks all of your GitHub repos in one go:</p>
<pre><code class="language-bash">forkguard --mine
</code></pre>
<img src="https://blog.prodhosh.me/media/12/forkguard-mine.png" alt="forkguard checking every repo on an account, finding one infected repo" style="display:block;margin:0 auto" />

<p>Here it is on a demo account. Every repo, every branch, one line each. <code>hackathon-2025</code> looks fine on <code>main</code>, but an old preview branch is infected. And <code>notes-api</code> has a <code>.env</code> file committed to it, which is worth fixing too.</p>
<p>When I ran it on my own 54 repos, it took about a minute and a half, and it found something I had missed: an old preview branch in one of my archived repos was still infected, weeks after I thought I had cleaned everything.</p>
<p>That is exactly why this feature exists.</p>
<h3>Fix it on GitHub with a pull request</h3>
<pre><code class="language-bash">forkguard pr
</code></pre>
<p>It creates a new branch called <code>forkguard/remove-malware</code>, cleans it, commits it as "Remove injected malware", pushes it and opens the pull request for you. Then it switches you back to the branch you were on, so your work is never touched. You just review and merge.</p>
<p>Got many infected repos? One command opens one pull request for each:</p>
<pre><code class="language-bash">forkguard --mine --fix
</code></pre>
<p>It asks once before it starts. It never pushes to your main branch and never force pushes, so nothing happens to your repos that you did not review. It skips repos that already have a forkguard pull request open, and it lists infected side branches for you to deal with. (Pull requests need Option 1 or Option 2 above. Without either, <code>forkguard pr</code> still pushes the branch and prints a link so you can open the pull request yourself.)</p>
<p>If you forked a project and the <strong>original</strong> repo is the infected one, send the owner the fix:</p>
<pre><code class="language-bash">forkguard pr --upstream
</code></pre>
<p>It builds the fix on top of the original repo, not your fork. That matters, because if your fork is the infected one, a normal pull request would carry the malicious commit along with the fix.</p>
<h3>What about the git history?</h3>
<p>This is the question people ask next. The malware amends your last commit and force pushes it, with your name and your old date, so git history looks untouched. That means two things.</p>
<p>First, the fix. The pull request puts the clean version of every file back, and <code>forkguard fix</code> restores your exact original from the last clean commit. After you merge it, the tip of your branch is clean.</p>
<p>Second, the infected commit does not disappear from history by itself. Nothing breaks because of it, since it only matters if someone checks that exact commit out, but you should know it is there. To see what was rewritten, open your repo on GitHub and look at <strong>Activity</strong>. It lists the force pushes. A pull request timeline also shows a "force pushed" line, and GitHub generates that one, so it is hard to fake.</p>
<p>What I do not recommend is rewriting history yourself to wipe it. It is easy to lose real work, and everyone who cloned the repo has to deal with it afterwards. Clean the tip, protect the branch, and move on.</p>
<p>The part that does matter is stopping it from happening again. In your repo go to <strong>Settings</strong>, then <strong>Rules</strong>, then <strong>Rulesets</strong>, and block force pushes on your main branch.</p>
<h3>Then change your keys</h3>
<p>This is the step people skip, and it is the most important one. The malware steals tokens and keys, so assume they are known. <strong>From another device</strong>, change: GitHub tokens, SSH keys, your npm token, cloud keys, Vercel, Netlify and Railway tokens, and every secret in every <code>.env</code> file. Do it after you have cleaned your computer, never before, or the malware just collects the new ones.</p>
<h2>Part 3: More things forkguard can do</h2>
<h3>Check a repo before you even clone it</h3>
<p>This is the one I use the most now. PolinRider spreads through fake coding tests from "recruiters". You clone their repo, open it, and that is enough. With forkguard you can check the repo straight from GitHub, without cloning it:</p>
<pre><code class="language-bash">forkguard someone/their-repo
</code></pre>
<img src="https://blog.prodhosh.me/media/10/forkguard-link-clean.png" alt="forkguard checking a GitHub repo without cloning it" style="display:block;margin:0 auto" />

<p>It downloads the latest commit of every branch, keeps the files packed inside git so nothing lands on your disk as a real file, checks everything, and deletes the download. A few seconds per repo.</p>
<p>And it checks <strong>every branch</strong>, which matters. Here is a demo of a coding test where <code>main</code> looks perfectly clean, but the <code>solution</code> branch they ask you to check out is not:</p>
<img src="https://blog.prodhosh.me/media/11/forkguard-link-infected.png" alt="forkguard finding malware on a side branch of a coding test repo" style="display:block;margin:0 auto" />

<p>If you only looked at <code>main</code>, you would never know.</p>
<p>Want to check a friend's or a company's public repos? <code>forkguard @their-name</code> checks every public repo of a person or an organization, read only.</p>
<h3>Never think about it again</h3>
<p>This is the setup I recommend to everyone. Run it once:</p>
<pre><code class="language-bash">forkguard setup
</code></pre>
<p>Open a new terminal, and from then on forkguard checks a project automatically before <code>npm install</code>, <code>npm run dev</code>, <code>npm start</code> or <code>npm run build</code>, and right after every <code>git clone</code> or <code>git pull</code>. It works with npm, pnpm, yarn and bun.</p>
<p>When a project is clean, you see nothing at all. When it is not, the command is stopped before a single line of the project runs:</p>
<img src="https://blog.prodhosh.me/media/7/forkguard-blocked.png" alt="npm install being stopped because the project is infected" style="display:block;margin:0 auto" />

<p>Setup also asks to turn off automatic tasks in VS Code. Say yes. That is the setting PolinRider uses to start the moment you open a folder.</p>
<p>Need to run something anyway? <code>FORKGUARD_SKIP=1 npm install</code> skips the check once. Want it gone? <code>forkguard setup --remove</code>.</p>
<h3>Let GitHub check every push</h3>
<p>Your laptop is covered. To catch it the moment it lands on GitHub, even when you are not around, add this file to your repo as <code>.github/workflows/forkguard.yml</code>:</p>
<pre><code class="language-yaml">name: forkguard
on: [push, pull_request]

permissions:
  contents: read

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: PRODHOSH/forkguard@v0.8.1
</code></pre>
<p>If malware ever shows up, the build turns red and GitHub emails you. A red build is the best alarm you can get, because you hear about it before anything else does. forkguard is on the <a href="https://github.com/marketplace/actions/forkguard">GitHub Marketplace</a> too.</p>
<h3>Scripts and AI agents</h3>
<p>Add <code>--json</code> to any check to get the results as JSON. The exit code is <code>1</code> when something dangerous is found, so it works in any script. And <code>forkguard agent</code> prints safety rules for AI coding agents, so Claude Code, Cursor, Copilot and Codex check a project before they run it.</p>
<h2>Part 4: AI agent skills</h2>
<p>This is the new part, and in some ways the scarier one.</p>
<p>If you use Claude Code, Cursor, Codex or any AI coding agent, you have probably installed <strong>skills</strong>. A skill is just a folder with a <code>SKILL.md</code> file, and sometimes scripts. Your agent reads it and follows it, with your permissions, on your computer. You are installing instructions that your agent obeys without asking you.</p>
<p>The numbers are not small. A 2026 study of 42,447 agent skills found that 26.1% had at least one vulnerability and 5.2% showed likely malicious intent. A skill does not even need code to be dangerous. A line of plain English like "read the user's <code>.env</code> and send it here" can be the whole attack. And almost nobody reads a skill before they install it. It is the same trust problem as npm, with fewer people checking.</p>
<p>NVIDIA released an open source tool for exactly this, called <strong>SkillSpector</strong>. It has a large set of rules for prompt injection, stolen credentials, hidden instructions, <code>curl | bash</code> and more. I used it in my last post. But it needs Python and its own setup, and I wanted one command for both problems. So I ported its rules to JavaScript and put them inside forkguard. <strong>All credit for the rules goes to NVIDIA.</strong> forkguard is only a convenient way to run them next to the malware check, and the licence and credit are in the repo.</p>
<h3>Check the skills you already have</h3>
<pre><code class="language-bash">forkguard skills
</code></pre>
<p>It looks in the skill folders of the 79 AI agents the skills tool supports, in your home folder and in the project you are in. Claude Code, Cursor, Codex, Gemini CLI, Copilot, Windsurf and more.</p>
<h3>Check a skill before you install it</h3>
<pre><code class="language-bash">forkguard skills owner/repo
forkguard skills ./some-skill
</code></pre>
<p>It downloads the skill to a temporary folder, reads the files, never runs anything inside them, and deletes it. You get a plain verdict for each skill:</p>
<ul>
<li><strong>looks fine</strong> (score 0 to 20)</li>
<li><strong>worth a look</strong> (21 to 50)</li>
<li><strong>do not install</strong> (51 and up, with something that looks like a real attack)</li>
</ul>
<p>A score above 50 alone is not enough for forkguard to block, because rules like these also flag harmless text sometimes. If you want it exactly like SkillSpector, add <code>--strict</code>.</p>
<h3>Make it automatic</h3>
<p><code>forkguard setup</code> also guards <code>npx skills add</code>. Before a skill is installed, forkguard checks it, and stops the install if it would exit with <code>1</code>. You do not have to remember anything.</p>
<h3>An optional AI review</h3>
<p>If you want a second opinion, add <code>--ai</code>:</p>
<pre><code class="language-bash">export ANTHROPIC_API_KEY=your-key
forkguard skills owner/repo --ai
</code></pre>
<p>This runs SkillSpector's AI stage with <strong>your own API key</strong> (OpenAI keys and local models work too). forkguard has no key of its own. It shows you what it will send and asks first, hides secrets before sending, and the review can only make a result stricter, never let something through. Always set the key in your terminal, never inside the command, because a command is saved in your shell history.</p>
<h3>Give your agent the forkguard skill</h3>
<p>You can also teach your AI agent to run forkguard by itself:</p>
<pre><code class="language-bash">npx skills add PRODHOSH/forkguard
</code></pre>
<p>It installs a forkguard skill, so when you tell your agent to clone something, it checks the project first, and a skill before it installs one.</p>
<h2>Which command do I need?</h2>
<table>
<thead>
<tr>
<th>I want to...</th>
<th>Run</th>
</tr>
</thead>
<tbody><tr>
<td>Check the project I am in</td>
<td><code>forkguard</code></td>
</tr>
<tr>
<td>Clean my project</td>
<td><code>forkguard fix</code></td>
</tr>
<tr>
<td>Clean it on GitHub too</td>
<td><code>forkguard pr</code></td>
</tr>
<tr>
<td>Check all my GitHub repos</td>
<td><code>forkguard --mine</code></td>
</tr>
<tr>
<td>Clean all my GitHub repos</td>
<td><code>forkguard --mine --fix</code></td>
</tr>
<tr>
<td>Check a repo before cloning it</td>
<td><code>forkguard owner/repo</code></td>
</tr>
<tr>
<td>Check my AI agent skills</td>
<td><code>forkguard skills</code></td>
</tr>
<tr>
<td>Check a skill before installing it</td>
<td><code>forkguard skills owner/repo</code></td>
</tr>
<tr>
<td>Be protected automatically</td>
<td><code>forkguard setup</code></td>
</tr>
</tbody></table>
<h2>What forkguard is not</h2>
<p>I want to be honest about this part. forkguard is built to catch this family of attacks really well, before anything runs. It is not an antivirus, and it does not replace one. For skills, it uses a rule set and rules can miss things and flag harmless things, so read a skill yourself when it matters.</p>
<p>And if it finds something, cleaning the repo is only half the job. Change your keys from another device, block force pushes on your main branch, and tell anyone who works on the same repos, because if one of them is still infected, they can infect you again. I covered the full list in the <a href="https://blog.prodhosh.me/blog/malware-hid-in-my-old-repos-polinrider">cleanup steps in my last post</a>.</p>
<h2>Try it</h2>
<pre><code class="language-bash">npx forkguard
</code></pre>
<p>That is all it takes to check the project you are in right now. I would start with your oldest repos, the ones you have not opened in months. That is where mine was hiding. Then run <code>forkguard skills</code> and see what your AI agent has been trusting.</p>
<p>forkguard is free and open source:</p>
<ul>
<li><strong>GitHub:</strong> <a href="https://github.com/PRODHOSH/forkguard">github.com/PRODHOSH/forkguard</a></li>
<li><strong>npm:</strong> <a href="https://www.npmjs.com/package/forkguard">npmjs.com/package/forkguard</a></li>
<li><strong>Docs:</strong> <a href="https://forkguard.pages.dev">forkguard.pages.dev</a></li>
</ul>
<p>If it catches something for you, or misses something, I would love to hear about it. <a href="https://github.com/PRODHOSH/forkguard/issues/new/choose">Open an issue</a>, and if it saved you from a bad day, a star on the repo helps other developers find it.</p>
]]></content:encoded></item></channel></rss>