Find the holes before someone else does. A fast, 100% Rust vulnerability scanner: XSS, SQL injection, leaked secrets, dependency CVEs and AI agent setups.
Rust ai-agentsclaude-codeclaude-code-pluginclicodexcursordevsecopsmcposvowasprustsastsecret-scanningsecretssecuritysecurity-scannersql-injectionvulnerabilityvulnerability-scannerxss
feat(secrets): detect Fly.io access tokens (#193)
Pranav Arya0a49b6119970
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 62b52d4..5e21588 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -21,6 +21,8 @@by 64 lower-case hex characters).- Secrets: new rule `secret.newrelic-key` (critical) for New Relic user API keys (`NRAK-` followedby 27 upper-case letters and digits).+- Secrets: new rule `secret.flyio-token` (critical) for Fly.io access tokens (`fo1_` followed by 43+ letters, digits, `_` or `-`).- Report: the summary line says `Scanned 1 file` and `1 package checked against OSV.dev` for acount of one; other counts stay plural.- Code: the JavaScript and Python patterns in `code.sql-injection` now also match escapeddiff --git a/README.md b/README.mdindex 4f616fd..dc109e5 100644--- a/README.md+++ b/README.md@@ -20,7 +20,7 @@ Every finding comes with the line, the reason and the fix.</p><a href="https://github.com/erkamyaman/safe-anything"><img src="https://img.shields.io/github/stars/erkamyaman/safe-anything?style=social" alt="GitHub stars"></a></p>-<p align="center"><b><a href="#quick-start">Install</a></b> · <a href="https://github.com/erkamyaman/safe-anything/releases">Releases</a> · <a href="#for-ai-agents">Claude Code plugin</a> · <a href="#in-ci">GitHub Action</a> · <a href="docs/rules.md">All 109 rules</a> · <a href="docs/agent-setups.md">Agent setups</a><br>+<p align="center"><b><a href="#quick-start">Install</a></b> · <a href="https://github.com/erkamyaman/safe-anything/releases">Releases</a> · <a href="#for-ai-agents">Claude Code plugin</a> · <a href="#in-ci">GitHub Action</a> · <a href="docs/rules.md">All 110 rules</a> · <a href="docs/agent-setups.md">Agent setups</a><br>Made in Türkiye 🇹🇷 by <a href="https://github.com/erkamyaman">erKam Yaman</a>, who also made <a href="https://github.com/erkamyaman/rust-anything">rust-anything</a> · <a href="https://github.com/sponsors/erkamyaman">❤️ Sponsor me</a> · Sponsored by <a href="https://coderabbit.link/er-kam">CodeRabbit</a></p><p align="center">@@ -105,13 +105,13 @@ it hides that finding.## What it finds-109 rules, each with a CWE id, an OWASP category and a link to the OWASP page that explains it.+110 rules, each with a CWE id, an OWASP category and a link to the OWASP page that explains it.The full list is in [docs/rules.md](docs/rules.md).| | || --- | --- || **Code** | SQL injection, command injection, XSS (`innerHTML`, `dangerouslySetInnerHTML`, `v-html`, `echo $_GET`, `raw`), `eval` and `new Function`, path traversal, file inclusion from request input, SSRF, open redirects, unsafe deserialization (pickle, `yaml.load`, `ObjectInputStream`, `BinaryFormatter`, `unserialize`, `Marshal`), TLS checks turned off, MD5/SHA-1, DES/RC4/ECB, JWT `none`, template injection, CORS `*`, debug mode, insecure cookies, `Math.random` tokens, `GRANT ALL` and plain-text passwords in SQL files. JS/TS, Python, Go, Java, Kotlin, PHP, Ruby, C#, SQL |-| **Secrets** | AWS (key ids and secret access keys), GitHub, GitLab, Slack, Stripe, Shopify, npm, PyPI, RubyGems, Docker Hub, OpenAI, Anthropic, Groq, Google, Hugging Face, Mailgun, SendGrid, Telegram, DigitalOcean, Heroku, Databricks, Perplexity, OpenRouter, Notion, Twilio, Linear, Prefect, Postman, Pulumi, Sentry, New Relic, Supabase, Grafana and Doppler keys, Google OAuth client secrets, Slack and Discord webhook URLs, private keys (also inside service-account JSON) and age keys, passwords in code, credentials in connection strings, committed `.env` files, real values in `.env.example`, a `.gitignore` that misses `.env`, secrets behind public prefixes (`NEXT_PUBLIC_`, `VITE_`, `EXPO_PUBLIC_`) that ship in the client bundle |+| **Secrets** | AWS (key ids and secret access keys), GitHub, GitLab, Slack, Stripe, Shopify, npm, PyPI, RubyGems, Docker Hub, OpenAI, Anthropic, Groq, Google, Hugging Face, Mailgun, SendGrid, Telegram, DigitalOcean, Heroku, Fly.io, Databricks, Perplexity, OpenRouter, Notion, Twilio, Linear, Prefect, Postman, Pulumi, Sentry, New Relic, Supabase, Grafana and Doppler keys, Google OAuth client secrets, Slack and Discord webhook URLs, private keys (also inside service-account JSON) and age keys, passwords in code, credentials in connection strings, committed `.env` files, real values in `.env.example`, a `.gitignore` that misses `.env`, secrets behind public prefixes (`NEXT_PUBLIC_`, `VITE_`, `EXPO_PUBLIC_`) that ship in the client bundle || **Agent setups** | `bypassPermissions` and `--dangerously-skip-permissions`, pre-approved `Bash`, `enableAllProjectMcpServers`, MCP servers run with unpinned `npx`/`uvx`/`docker`, MCP tokens in plain text, remote MCP over `http://`, `curl \| sh` in hooks and skills, prompt-injection text, skills that read `~/.ssh` or cloud credentials, invisible Unicode in instructions. [More](docs/agent-setups.md) || **Mobile** | Android `debuggable`, `allowBackup`, cleartext traffic, exported content providers, WebView file access and JS bridges, world-readable files; iOS ATS turned off; tokens in UserDefaults, SharedPreferences, AsyncStorage or localStorage || **Config** | Docker (unpinned base, root, secrets in `ENV`, `ADD <url>`), `curl \| sh` in scripts, Dockerfiles and workflow `run:` steps, GitHub Actions (`pull_request_target`, `write-all`, actions on `@main`, script injection from PR titles), privileged containers, `hostNetwork`, Terraform (open ingress, public buckets, S3 public access blocks turned off, public or unencrypted databases), nginx autoindex, TLS 1.0/1.1 |@@ -195,7 +195,7 @@ lockfile listed under Dependencies. Nothing is executed. The only network call inames and versions to OSV.dev ([privacy](docs/privacy.md)).It finds known patterns; it does not trace data through your program. A clean scan means none of-these 109 problems were found, not that the code is safe. [Design notes](docs/adr).+these 110 problems were found, not that the code is safe. [Design notes](docs/adr).## Creditsdiff --git a/docs/assets/social.html b/docs/assets/social.htmlindex 0d2dd5a..b228dc7 100644--- a/docs/assets/social.html+++ b/docs/assets/social.html@@ -31,7 +31,7 @@<p class="sub">Code, secrets, mobile, cloud config, dependencies, and the AI agent setup that writes it all. One command.</p><div class="stats"><div class="stat"><b><0.1 s</b><small>for 1,195 files (Juice Shop, M4)</small></div>- <div class="stat"><b>109 rules</b><small>with CWE and OWASP ids</small></div>+ <div class="stat"><b>110 rules</b><small>with CWE and OWASP ids</small></div><div class="stat"><b>100% Rust</b><small>one binary, no runtime</small></div></div></div>diff --git a/docs/rules.md b/docs/rules.mdindex e5f3971..a517869 100644--- a/docs/rules.md+++ b/docs/rules.md@@ -32,7 +32,7 @@ Every rule safe-anything checks, generated from `safe-anything --list-rules --js| [`code.sql-grant-all`](https://cheatsheetseries.owasp.org/cheatsheets/Database_Security_Cheat_Sheet.html) | medium | [CWE-250](https://cwe.mitre.org/data/definitions/250.html) | A01:2021 Broken Access Control | A database user gets every privilege on every database. || [`code.sql-plaintext-password`](https://cheatsheetseries.owasp.org/cheatsheets/Database_Security_Cheat_Sheet.html) | medium | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | A database password is written in a SQL file. |-## Secrets (46)+## Secrets (47)| Rule | Severity | CWE | OWASP | What it means || --- | --- | --- | --- | --- |@@ -64,6 +64,7 @@ Every rule safe-anything checks, generated from `safe-anything --list-rules --js| [`secret.telegram-bot-token`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | high | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | A Telegram bot token is written in the file. || [`secret.digitalocean-token`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | critical | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | A DigitalOcean token is written in the file. || [`secret.heroku-key`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | critical | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | A Heroku API key is written in the file. |+| [`secret.flyio-token`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | critical | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | A Fly.io access token is written in the file. || [`secret.databricks-token`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | critical | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | A Databricks personal access token is written in the file. || [`secret.twilio-api-key`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | critical | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | A Twilio API key is written in the file. || [`secret.linear-api-key`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | critical | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | A Linear API key is written in the file. |diff --git a/src/rules/secrets.rs b/src/rules/secrets.rsindex 7c5a020..88e9cc0 100644--- a/src/rules/secrets.rs+++ b/src/rules/secrets.rs@@ -401,6 +401,12 @@ pub static RULES: &[Rule] = &[r"(?:\\[nrt]|\b)(HRKU-AA[0-9A-Za-z_\-]{58})(?:[^0-9A-Za-z_\-]|\z)","A Heroku API key is written in the file."),+ secret!(+ "secret.flyio-token",+ Critical,+ r"(?:\\[nrt]|\b)(fo1_[A-Za-z0-9_\-]{43})(?:[^A-Za-z0-9_\-]|\z)",+ "A Fly.io access token is written in the file."+ ),secret!("secret.databricks-token",Critical,diff --git a/tests/common/mod.rs b/tests/common/mod.rsindex ab994d4..b64944a 100644--- a/tests/common/mod.rs+++ b/tests/common/mod.rs@@ -160,6 +160,8 @@ pub fn fake(name: &str) -> String {"heroku" => ["HR", "KU-AA", &body(57, MIXED), "-"].concat(),"heroku-short" => ["HR", "KU-AA", &body(57, MIXED)].concat(),"heroku-no-aa" => ["HR", "KU-", &body(58, MIXED)].concat(),+ "flyio" => ["fo", "1_", &body(42, MIXED), "-"].concat(),+ "flyio-short" => ["fo", "1_", &body(41, MIXED), "-"].concat(),other => panic!("no fake value named {other}"),}}diff --git a/tests/fixtures/secrets/EXPECTED b/tests/fixtures/secrets/EXPECTEDindex 4d76394..2790eea 100644--- a/tests/fixtures/secrets/EXPECTED+++ b/tests/fixtures/secrets/EXPECTED@@ -77,3 +77,5 @@ config.py:108 secret.prefect-api-keyconfig.py:110 secret.openrouter-keyconfig.py:112 secret.newrelic-keyconfig.py:114 secret.newrelic-key+config.py:115 secret.flyio-token+config.py:117 secret.flyio-tokendiff --git a/tests/fixtures/secrets/config.py b/tests/fixtures/secrets/config.pyindex 567e7f2..0d41a49 100644--- a/tests/fixtures/secrets/config.py+++ b/tests/fixtures/secrets/config.py@@ -112,3 +112,6 @@ openrouter_lookalike = "{{fake:openrouter-short}} {{fake:openrouter-upper}} my{{newrelic = "{{fake:newrelic}}"newrelic_lookalike = "{{fake:newrelic-short}} my{{fake:newrelic}} {{fake:newrelic}}A"newrelic_escaped = "line\\n{{fake:newrelic}}"+flyio = "{{fake:flyio}}"+flyio_lookalike = "{{fake:flyio-short}} my{{fake:flyio}} {{fake:flyio}}a"+flyio_escaped = "line\\n{{fake:flyio}}"