Skip to content

Find the holes before someone else does. A fast, 100% Rust vulnerability scanner: XSS, SQL injection, leaked secrets, dependency CVEs and AI agent setups.

Detect Slack app-level tokens (xapp-) in secret.slack-token (#150)

K L Aadithya96a937b890ab
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4d2a291..b1f15be 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+- Secrets: `secret.slack-token` also finds Slack app-level tokens (`xapp-1-A0123...-1234567890123-` and
+ lowercase letters and digits), which let a Socket Mode app connect as the app. A bare `xapp-` stays quiet.
- Secrets: `secret.env-file` and `secret.env-example-value` stay on one line instead of matching
across line breaks, so an empty assignment like `API_KEY=` followed by another variable is no
longer reported, a blank line above a placeholder like `your-placeholder-key-here` no longer
diff --git a/src/rules/secrets.rs b/src/rules/secrets.rs
index eb8fabf..f984c3b 100644
--- a/src/rules/secrets.rs
+++ b/src/rules/secrets.rs
@@ -210,7 +210,7 @@ pub static RULES: &[Rule] = &[
secret!(
"secret.slack-token",
High,
- r"\bxox[baprs]-[A-Za-z0-9-]{10,}",
+ r"\b(?:xox[baprs]-[A-Za-z0-9-]{10,}|xapp-\d-[A-Z0-9]+-\d+-[a-z0-9]+)",
"A Slack token is written in the file."
),
Rule {
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index b11a496..59d9136 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -35,6 +35,15 @@ pub fn fake(name: &str) -> String {
&body(24, MIXED),
]
.concat(),
+ "slack-app" => [
+ "xa",
+ "pp-1-",
+ "A0",
+ &body(9, UPPER),
+ "-4815162342123-",
+ &body(64, HEX),
+ ]
+ .concat(),
"slack-webhook" => [
"https://hooks.",
"slack.com/services/",
diff --git a/tests/fixtures/secrets/EXPECTED b/tests/fixtures/secrets/EXPECTED
index 3187aa2..7dc75ba 100644
--- a/tests/fixtures/secrets/EXPECTED
+++ b/tests/fixtures/secrets/EXPECTED
@@ -57,3 +57,4 @@ config.py:68 secret.sentry-token
config.py:70 secret.supabase-token
config.py:72 secret.grafana-token
config.py:74 secret.doppler-token
+config.py:76 secret.slack-token
diff --git a/tests/fixtures/secrets/config.py b/tests/fixtures/secrets/config.py
index 5208533..0a37d0b 100644
--- a/tests/fixtures/secrets/config.py
+++ b/tests/fixtures/secrets/config.py
@@ -73,3 +73,5 @@ grafana = "{{fake:grafana}}"
grafana_short = "glsa_abc123_abcd1234"
doppler = "{{fake:doppler}}"
doppler_short = "dp.pt.abc123"
+slack_app = "{{fake:slack-app}}"
+slack_app_short = "xapp- xapp-token"