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
fix(secrets): skip angle-bracket password placeholders in connection strings (#13)
Ming6bc53d3adabd
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 834896e..dfa1beb 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,8 @@## Unreleased+- Secrets: `secret.url-credentials` skips a connection string whose password is an angle-bracket placeholder+ such as `mongodb+srv://<username>:<password>@host/db`, the form MongoDB Atlas shows in its docs.- Dependencies: `pnpm-lock.yaml` is read again. A blank line ended the `packages:` section, andpnpm writes one right after it, so every pnpm project reported 0 packages checked.diff --git a/src/rules/secrets.rs b/src/rules/secrets.rsindex db8cd60..8464ecb 100644--- a/src/rules/secrets.rs+++ b/src/rules/secrets.rs@@ -154,7 +154,7 @@ pub static RULES: &[Rule] = &[files: any_text,pattern: r#"\b[a-z][a-z0-9+.\-]*://[^\s:/@"'`]+:[^\s@/"'`$]{4,}@[^\s"'`]+"#,unless: Some(- r"(?i)localhost|127\.0\.0\.1|0\.0\.0\.0|example\.(com|org)|:password@|:pass@|\$\{|\buser(?:name)?:(?:token|pass(?:word)?|secret|pat)@|:\*+@",+ r"(?i)localhost|127\.0\.0\.1|0\.0\.0\.0|example\.(com|org)|:password@|:pass@|:<[^>@]*>@|\$\{|\buser(?:name)?:(?:token|pass(?:word)?|secret|pat)@|:\*+@",),message: "A connection string carries a username and password.",fix: ROTATE,diff --git a/tests/fixtures/secrets/app/db.js b/tests/fixtures/secrets/app/db.jsindex 62e6928..f420970 100644--- a/tests/fixtures/secrets/app/db.js+++ b/tests/fixtures/secrets/app/db.js@@ -4,3 +4,4 @@ const tpl = `postgres://${user}:${pass}@${host}/db`;// a URL such as https://user:token@host/repo.git is redactedconst shown = "postgres://app_user:****@db-prod.acme.io/app";AccessToken: "xoxp-...",+const atlas = "mongodb+srv://<username>:<password>@cluster0.abcde.mongodb.net/test";