Scan your code
in one minute.
Trojan runs on your machine and reports security issues in plain English. This guide gets you from zero to your first report. No security background needed.
Download the desktop app
Trojan runs on macOS (Apple Silicon) and Windows. Download it, open your project, and run your first scan. No security background needed.
Supported: JavaScript / TypeScript, Python, Go, Ruby, Rust, Java, PHP and more.
Understanding results
Every finding answers three questions in plain language: what is wrong, why it matters, and the exact fix. Here's a typical entry:
Why it matters: Anyone who can read this file (or your git history) can use this key to access your AWS account and run up a bill or steal data.
Fix: Move the key to an environment variable, rotate it in the AWS console, and add .env to your .gitignore.
Severity levels
Trojan ranks every finding on five levels, by how likely it is to be exploited and how much damage it would do. Work top to bottom; stop when it's safe to ship.
Config file
Drop a trojan.config.json at your project root to set defaults. Everything is optional.
{
"minSeverity": "medium",
"scan": ["secrets", "deps", "code"],
"ignore": ["vendor/**", "*.min.js"]
}Ignoring findings
Sometimes a finding is a false positive or an accepted risk. Silence a single line with a comment. Trojan records who ignored it and why:
// trojan-ignore: test fixture, not a real key
const SAMPLE_KEY = "AKIA...EXAMPLE";CI/CD Pro
Fail a build when a scan finds anything above your threshold. Trojan exits non-zero so your pipeline stops. Here's a GitHub Actions step:
- name: Trojan security scan
run: trojan ci --output trojan.sarif
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trojan.sarifPre-commit hook
Block commits that introduce Critical or High severity findings. Install from your project root:
trojan hook install
This writes a pre-commit hook that runs a fast, headless scan before each commit. If Critical or High findings are detected, the commit is blocked. To remove:
trojan hook uninstall
CLI commands
| Command | What it does |
|---|---|
| trojan scan | Scan the current directory |
| trojan scan --fix | Apply safe automatic fixes (uses tokens) |
| trojan scan --watch | Re-scan on every file save |
| trojan dast <url> | Scan a running local server for runtime vulnerabilities |
| trojan ci | CI mode: outputs SARIF 2.1.0, exits non-zero on findings above threshold |
| trojan ci --severity <level> | Set the exit threshold (default: high) |
| trojan hook install | Install a pre-commit hook that blocks Critical/High commits |
| trojan hook uninstall | Remove the Trojan pre-commit hook |
| trojan balance | Show your Trojan Token balance |
| trojan watch | Re-scan on every file save |
| trojan login | Sign in. Every account gets 500 free tokens every month |
| trojan mcp install | Configure AI editors to use the Trojan MCP server |
| trojan update | Check for and install a newer version |
| trojan version | Print the installed version |
FAQ
Does my code get uploaded?
No. Scanning runs entirely on your machine. See the privacy policy for exactly what a signed-in account syncs.
How long does a scan take?
A few seconds for most projects, about 4 seconds on a 100,000-line repository. Large monorepos scan incrementally.
Will it break my build?
Only if you ask it to. Locally it just reports; in CI it fails only above the threshold you set with --severity.