forkguarddocs
forkguard

Documentation

Catch malware hidden in a repo before you install or run it. Check a folder, a GitHub link or every repo you own, then clean what it finds and open a pull request.

On this page
npx forkguard

No install needed: npx runs it once. You need Node.js 18 or newer and git. If it prints a list, something is wrong. If it prints one green line, you are fine.

#Start here

New to forkguard? Follow these four steps in order. Each one is a few minutes.

  1. Install itOne command. Needs Node.js 18+ and git.
  2. Check a projectYour first check, and how to read the result.
  3. Clean itRemove what it found and get your original files back.
  4. Stay protectedCheck automatically before every npm install, for good.

#I want to…

Already know what you need? Jump straight to it.

#Every command

CommandWhat it doesChanges anything?
`forkguard`Checks the current folder, or another oneNo
`forkguard owner/repo`Checks a GitHub repo, every branch, without downloading its filesNo
`forkguard --mine`Checks every repo you own on GitHubNo
`forkguard fix`Removes what it found, on your computerYes, your files
`forkguard pr`Removes it on a new branch and opens a pull requestYes, a branch and a pull request
`forkguard setup`Checks automatically before npm install and after git cloneYes, your shell profile
`forkguard agent`Safety rules for AI coding agents (next release)Only with --write

Only fix, pr, setup and agent --write ever change anything. Checking is always read only.

#What forkguard does

Some malware hides inside ordinary looking repositories. The code sits after hundreds of blank spaces at the end of a normal line, so your editor shows nothing. It rewrites your latest commit, keeping the author, date and message, so git shows nothing either. The moment you open the folder in VS Code, or run npm install or npm run dev, it runs, steals tokens and keys, and spreads to every repo you can push to.

forkguard looks for every trick this malware uses, before anything runs. It never runs code from the project it checks, and it never uploads your code anywhere.

#How these pages work

Each command page is laid out like a manual page, with the sections Name, Synopsis, Description and so on. Every section is written twice:

SwitchYou see
Off (the default)Plain words, with examples and sample output. Start here.
On, “Less comfortable”The short reference text you would find in a real manual page.

Flip the switch on a section to change just that section, or use the switch in the header to change the whole page. Your choice is remembered.

Edit this page on GitHub View as Markdown

Type to search. Use the arrow keys and Enter.