forkguarddocs

JSON output

Add --json to read results from a script or an agent.

On this page

#A folder

forkguard ./app --json
{
  "root": "/home/me/app",
  "checked": 433,
  "findings": [
    {
      "level": "high",
      "file": "init",
      "rule": "hidden-code",
      "message": "Code hidden after 776 blank spaces on line 35",
      "fix": "delete"
    }
  ]
}

#A GitHub repo

forkguard someone/their-repo --json
{
  "name": "someone/their-repo",
  "url": "https://github.com/someone/their-repo",
  "branches": [
    {
      "name": "main",
      "checked": 112,
      "findings": []
    }
  ]
}

If the repo could not be downloaded you get { name, url, error } instead, and the exit code is 2.

#All your repos

forkguard --mine --json prints a list of the repo results above, one per repo, sorted by name. Each also has an archived field.

#Fields

FieldMeaning
level"high" or "medium".
fileThe file, relative to the project. A few findings use a label such as (latest commit) or a path to npm itself.
ruleWhich check found it. See the list below.
messageWhat is wrong, in plain words.
fixWhat forkguard fix will do, or null if a person has to decide.
checkedHow many files were looked at.
rootThe folder that was checked, resolved to a real path.

#Rule ids

Each id is explained in What it catches.

hidden-code   loader        script         lifecycle
bad-package   bad-package-installed   fake-font
decoy-folder  autorun       autorun-setting dropper
gitignore     prelude       config-long-line odd-vscode-file
env-not-ignored   secret    rewritten      npm-infected

#Fix values

fixWhat fix does
deleteDeletes the file.
delete-dirDeletes the folder.
stripCuts the malware out of your file.
scriptRemoves the injected step from a package.json script.
autorunRemoves the folder-open task from .vscode/tasks.json.
settingTurns automatic tasks off in .vscode/settings.json.
gitignoreRemoves the malware’s line from .gitignore.
ignore-envAdds .env* rules to .gitignore.
untrackRemoves a committed .env from git, keeping it on disk. Only forkguard pr does this.
nullA person has to decide.

#Read it in a script

forkguard --json | jq '.findings[] | select(.level == "high") | "\(.file): \(.message)"'

Where to next

Edit this page on GitHub View as Markdown

Type to search. Use the arrow keys and Enter.