Quick Answer: safe-anything is a Rust vulnerability scanner that runs one command over a repository and reports XSS, SQL injection, leaked secrets, risky cloud and mobile config, vulnerable dependencies, and unsafe AI agent setups. Install it with
cargo install safe-anything, then runsafe-anything .. It needs no account or upload, and it exits with 1 when it finds a high or critical issue.
Most teams learn about a SQL injection from a bug report, a penetration test, or a breach notice. By then the vulnerable line has been in production for months. A scanner that runs on your laptop or in CI catches the same patterns while the fix is still a one-line change. The safe-anything README describes a tool built for exactly that job, and it's fast enough that you'll stop noticing it runs.
What a Rust vulnerability scanner actually checks
Most people picture a scanner as a code-only tool. safe-anything covers four separate areas, and each one fails in a different way.
| Area | What gets flagged | Why it matters |
|---|---|---|
| Code | SQL and command injection, XSS sinks such as innerHTML and v-html, eval, SSRF, path traversal, unsafe deserialization, MD5 and SHA-1 | Maps to CWE-89 (SQL injection) and CWE-79 (XSS), the weaknesses behind many OWASP Top 10 incidents |
| Secrets | AWS, GitHub, Slack, Stripe, OpenAI, Anthropic and Google keys, private keys, connection-string passwords, committed .env files | Hardcoded credentials (CWE-798) are often exploited within hours of being pushed to a public repo |
| Stack | Docker, GitHub Actions, Terraform, Kubernetes, nginx, Android and iOS settings, plus locked dependencies | Config mistakes such as pull_request_target or open ingress rules are easy to miss in review |
| Agent setup | bypassPermissions, pre-approved Bash, unpinned npx MCP servers, curl | sh in hooks, invisible Unicode in instructions | Decides what an AI agent is allowed to do on your machine |
The README lists 74 rules in total, each tagged with a CWE id, an OWASP category, and a link to the matching OWASP Cheat Sheet. That mapping matters because a finding with a CWE id is easier to triage and to explain to a reviewer.
How the scan works, and why it's quick
safe-anything walks the repository once, in parallel, using the ignore crate that also powers ripgrep. It reads each file once and runs the applicable rules as compiled regular expressions. Where a regex can't tell safe code from unsafe code, the tool parses the file instead. MCP configs are read as JSON with comments, Dockerfiles are split into stages, and ten lockfile formats are parsed, including Cargo.lock, package-lock.json, poetry.lock, and go.mod.
The dependency check is the only network call. It sends package names and versions to OSV.dev, which returns known advisories along with the nearest fixed version. Nothing in your project is executed.
The speed claim is easy to verify. On OWASP Juice Shop, the README reports 1,195 files scanned in 0.03 s with 67 findings. Those numbers come from the author's own run on an Apple M4, so treat them as a sanity check on your own hardware, not a guarantee.
Reading a finding: the line, the reason, the fix
A scanner that only prints a rule id is hard to act on. Each safe-anything finding includes the file and line, the reason it fired, and a suggested fix. Output comes in three formats:
- Terminal output for a quick local run.
--jsonfor scripts and dashboards.--sariffor GitHub code scanning, which surfaces findings in the Security tab and on pull requests.
Several flags tune the noise level:
--severity mediumhides low-severity findings.--fail-on highsets the exit threshold, and--fail-on neveralways returns 0.safe-anything:ignorein a comment silences one line or the line after it..safe-anything-ignoreexcludes whole paths.
Here's where most teams get stuck. A finding you silence with a comment is a decision someone has to defend later. Keep the reason next to the ignore comment, or the suppression outlives the reasoning behind it.
The counter-intuitive part: a clean scan is not a safety certificate
The most common advice on scanners is to get the score to zero and call it secure. The README is blunter than most vendors: a clean scan means none of its 74 known patterns matched. It does not mean the code is safe.
The reason is simple. safe-anything does not trace data through your program. If user input passes through three functions and then reaches a SQL query, a pattern scanner only catches it when the sink itself looks dangerous. A taint-tracking SAST tool follows the flow, but usually at a cost in setup time and runtime. Use both where you can. Use the fast pattern scanner on every commit, and treat it as one layer among several.
The second surprise is test handling. In tests, specs, and fixtures, safe-anything reports only real provider keys and private keys unless you pass --include-tests. That's deliberate: fixtures are full of fake sk- strings and vulnerable snippets, and a scanner that flags them trains people to ignore output. The trade-off is that an SQL injection hiding in a test helper won't appear by default.
Scanning the AI agent setup, not just the code
This is the part most scanners ignore entirely. Consider a common failure mode: a developer adds a .mcp.json file with a GitHub token written in plain text, then wires a hook that runs curl | sh from a remote URL. Nothing in the application code looks wrong. The risk sits in the files that decide what the agent may do.
safe-anything reads Claude Code, Codex, Cursor, Gemini, and OpenCode settings, along with hooks and skills. It flags:
- MCP servers launched through unpinned
npx,uvx, ordockercommands. - Remote MCP endpoints served over
http://instead ofhttps://. - Skills that read
~/.sshor cloud credential directories. - Invisible Unicode characters hidden inside instruction files.
You can run it as an MCP server so the agent checks itself before committing, or before you install someone else's skill:
claude mcp add safe-anything -- safe-anything mcp
The README also ships a Claude Code plugin with a skill that tells the agent how to triage and fix findings. That's useful when you're reviewing a skill you didn't write.
Running it in CI, and the noise you'll need to manage
For GitHub Actions, the setup is short:
- Add the
erkamyaman/safe-anything@v1.0.2action withfail-on: high. - Add
github/codeql-action/upload-sarif@v4withif: always()so results upload even when the scan fails. - Point
sarif_fileatsafe-anything.sarif.
Expect some noise. The README says the noisiest rule is code.xss-inner-html. It fires on any HTML built from a variable, and in local tooling most of those hits aren't reachable by an attacker. The maintainer keeps it on because real XSS looks identical in the code. A practical approach is to run the full scan in CI, but gate merges only on high and critical findings, then review the XSS hits in a periodic sweep.
The README's own measurements show the spread. Express returned zero findings across 216 files. Flask returned two, and both were false positives by the author's hand review: an eval of the user's own shell startup file, and SHA-1 used for key derivation. The Anthropic skills repository returned six, mostly innerHTML in local review pages.
Frequently Asked Questions
What is a Rust vulnerability scanner?
A Rust vulnerability scanner is a command-line tool, written in Rust, that searches your code, config, and dependencies for known security weaknesses. safe-anything is one example. It runs locally, checks 74 rules tagged with CWE ids, and reports the file, line, reason, and fix for each finding.
How do I scan my repository for leaked secrets?
Install safe-anything with cargo install safe-anything, then run safe-anything . from the repository root. It detects provider keys, private keys, and passwords in code, along with committed .env files and real values in .env.example. Secrets are redacted in the output, so the report itself won't leak them.
Why does safe-anything skip my test files?
By default it reports only real provider keys and private keys in tests, specs, and fixtures, because fixtures contain fake credentials and vulnerable examples on purpose. Pass --include-tests to scan everything. Expect more output if you do.
Does a clean scan mean my code is secure?
No. A clean scan means none of the 74 known patterns matched. safe-anything does not trace data flow through your program, so a vulnerability that depends on how values move between functions can slip through. Pair it with a taint-tracking tool and code review for coverage you can rely on.
Start with one scan this week
Run safe-anything . --json on your most exposed repository, the one with an AI agent config or a NEXT_PUBLIC_ variable, and read every high finding before you change anything. Note which ones are real and which are noise, then decide whether a .safe-anything-ignore entry or a fix is the right call. Pass this to a teammate who's wrestling with leaked keys or a messy agent setup, and ask them to run the same scan.