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(agent): read bracketed IPv6 hosts and case-insensitive http in mcp-insecure-url (#90)
Ahmad Ghozali314a5ddd3929
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8c3f4a6..d0f19b9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -19,6 +19,7 @@only part of an ordinary word, so `PATH`, `PYTHONPATH`, `NODE_PATH`, `DISPATCH_MODE`, `AUTHOR`,`MONKEY_PATCH` and `KEYCHAIN_PROFILE` are not reported. `GITHUB_PAT`, `githubPat`, `OPENAI_APIKEY`,`daemonKey`, `patHash` and `clientSecret` still are.+- Agent: `agent.mcp-insecure-url` now reads a bracketed IPv6 host up to its closing `]` (only `[::1]` counts as local) and matches `http://` without regard to case.- Dependencies: `pubspec.lock` is read, so Dart and Flutter packages are checked against OSV.dev(`Pub` ecosystem). Packages from the `sdk` source, like `flutter`, are skipped.- Secrets: new rule `secret.gitlab-token` (critical) for GitLab personal access tokens (`glpat-` followed by 20 characters).diff --git a/src/rules/agent.rs b/src/rules/agent.rsindex 13ec46b..9b27a9f 100644--- a/src/rules/agent.rs+++ b/src/rules/agent.rs@@ -313,10 +313,16 @@ fn check_server(.get("url").or_else(|| server.get("serverUrl")).and_then(Value::as_str)- && let Some(rest) = url.strip_prefix("http://")+ && let Some(rest) = url+ .get(..7)+ .filter(|prefix| prefix.eq_ignore_ascii_case("http://"))+ .map(|_| &url[7..]){- let host = rest.split(['/', ':']).next().unwrap_or("");- if !matches!(host, "localhost" | "127.0.0.1" | "[") && !host.starts_with("[::1") {+ let host = match rest.find(']') {+ Some(end) if rest.starts_with('[') => &rest[..end + 1],+ _ => rest.split(['/', ':']).next().unwrap_or(""),+ };+ if !matches!(host, "localhost" | "127.0.0.1" | "[::1]") {let line = line_after(text, start, url);out.push(finding(file,diff --git a/tests/fixtures/agent/.mcp.json b/tests/fixtures/agent/.mcp.jsonindex cbd8634..82247ab 100644--- a/tests/fixtures/agent/.mcp.json+++ b/tests/fixtures/agent/.mcp.json@@ -85,6 +85,9 @@"X-Api-Token": "ApiKey ${ACME_KEY}","X-Acme-Key": "<your acme key here>"}- }+ },+ "mapped": { "type": "http", "url": "http://[::ffff:203.0.113.5]:8080/mcp" },+ "upper": { "type": "http", "url": "HTTP://203.0.113.5/mcp" },+ "local-v6": { "type": "http", "url": "http://[::1]:8080/mcp" }}}diff --git a/tests/fixtures/agent/EXPECTED b/tests/fixtures/agent/EXPECTEDindex 7b83939..03b01b7 100644--- a/tests/fixtures/agent/EXPECTED+++ b/tests/fixtures/agent/EXPECTED@@ -35,3 +35,5 @@.mcp.json:7 secret.github-tokenCLAUDE.md:2 agent.bypass-permissionsscripts/setup.sh:1 config.remote-script+.mcp.json:89 agent.mcp-insecure-url+.mcp.json:90 agent.mcp-insecure-url