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 Slack incoming webhook URLs (#100)
Onur Ugure9a4c9bcbf7f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex dbc8d96..a9281f5 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -32,6 +32,7 @@- Secrets: new rule `secret.npm-token` (critical) for npm access tokens (`npm_` followed by 36 letters or digits).- Secrets: new rule `secret.mailgun-key` (critical) for Mailgun private API keys (`key-` followed by 32 lowercase hex characters).- Secrets: new rule `secret.telegram-bot-token` (high) for Telegram bot tokens (8 to 10 digits, a colon, then 35 letters, digits, `_` or `-`).+- Secrets: new rule `secret.slack-webhook` (high) for Slack incoming webhook URLs (`hooks.slack.com/services/T…/B…/` and a 24-character token). The docs placeholder with `T00000000` or `XXXXXXXX` is skipped.- Config: new rule `config.tf-public-access-block` (medium) for `block_public_policy = false` or`restrict_public_buckets = false` in an `aws_s3_bucket_public_access_block` or `aws_s3_account_public_access_block`.- Secrets: new rule `secret.groq-key` (critical) for Groq API keys (`gsk_` followed by 52 letters or digits).diff --git a/README.md b/README.mdindex c3d6dd4..10fcf5b 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 81 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 82 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">@@ -86,7 +86,7 @@ safe-anything --list-rules## What it finds-81 rules, each with a CWE id, an OWASP category and a link to the OWASP page that explains it.+82 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).| | |@@ -175,7 +175,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 81 problems were found, not that the code is safe. [Design notes](docs/adr).+these 82 problems were found, not that the code is safe. [Design notes](docs/adr).## Creditsdiff --git a/docs/rules.md b/docs/rules.mdindex fb925fa..73c9cc0 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 (20)+## Secrets (21)| Rule | Severity | CWE | OWASP | What it means || --- | --- | --- | --- | --- |@@ -40,6 +40,7 @@ Every rule safe-anything checks, generated from `safe-anything --list-rules --js| [`secret.github-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 GitHub token is written in the file. || [`secret.gitlab-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 GitLab personal access token is written in the file. || [`secret.slack-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 Slack token is written in the file. |+| [`secret.slack-webhook`](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 Slack incoming webhook URL is written in the file. || [`secret.stripe-live-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 live Stripe secret key is written in the file. || [`secret.npm-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 | An npm access token is written in the file. || [`secret.huggingface-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 Hugging Face access token is written in the file. |diff --git a/src/rules/secrets.rs b/src/rules/secrets.rsindex f9b205e..0f8acc8 100644--- a/src/rules/secrets.rs+++ b/src/rules/secrets.rs@@ -137,6 +137,16 @@ pub static RULES: &[Rule] = &[r"\bxox[baprs]-[A-Za-z0-9-]{10,}","A Slack token is written in the file."),+ Rule {+ id: "secret.slack-webhook",+ family: Family::Secret,+ severity: Severity::High,+ files: any_text,+ pattern: r"\bhooks\.slack\.com/services/(T[A-Z0-9]{8,}/B[A-Z0-9]{8,}/[A-Za-z0-9]{24})\b",+ unless: Some(r"hooks\.slack\.com/services/[A-Za-z0-9/]*?(?:0{8}|(?i:x{8}))"),+ message: "A Slack incoming webhook URL is written in the file.",+ fix: ROTATE,+ },secret!("secret.stripe-live-key",Critical,diff --git a/tests/common/mod.rs b/tests/common/mod.rsindex c50e96e..0456eee 100644--- a/tests/common/mod.rs+++ b/tests/common/mod.rs@@ -26,6 +26,17 @@ pub fn fake(name: &str) -> String {&body(24, MIXED),].concat(),+ "slack-webhook" => [+ "https://hooks.",+ "slack.com/services/",+ "T0",+ &body(9, UPPER),+ "/B0",+ &body(9, UPPER),+ "/",+ &body(24, MIXED),+ ]+ .concat(),"stripe-live" => ["sk", "_live_", &body(24, MIXED)].concat(),"npm" => ["np", "m_", &body(36, MIXED)].concat(),"huggingface-token" => ["h", "f_", &body(34, LETTERS)].concat(),diff --git a/tests/fixtures/secrets/EXPECTED b/tests/fixtures/secrets/EXPECTEDindex cc22737..4d67e63 100644--- a/tests/fixtures/secrets/EXPECTED+++ b/tests/fixtures/secrets/EXPECTED@@ -24,4 +24,5 @@ config.py:19 secret.huggingface-tokenconfig.py:21 secret.mailgun-keyconfig.py:23 secret.telegram-bot-tokenconfig.py:26 secret.telegram-bot-token-config.py:27 secret.groq-key\ No newline at end of file+config.py:27 secret.groq-key+config.py:30 secret.slack-webhook\ No newline at end of filediff --git a/tests/fixtures/secrets/config.py b/tests/fixtures/secrets/config.pyindex c161f27..eda5477 100644--- a/tests/fixtures/secrets/config.py+++ b/tests/fixtures/secrets/config.py@@ -25,4 +25,6 @@ clock = "12:30:45"upstream = "localhost:8080"telegram_hyphen = "{{fake:telegram-hyphen}}"groq = "{{fake:groq}}"-groq_short = "gsk_short"\ No newline at end of file+groq_short = "gsk_short"+slack_docs = "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"+slack_webhook = "{{fake:slack-webhook}}"\ No newline at end of file