From 444cb8e6f11870e282db1e883cefaae15c525c6f Mon Sep 17 00:00:00 2001 From: Diego Braga Date: Mon, 16 Nov 2026 10:37:57 +0100 Subject: [PATCH] fix(security): gitleaks: allowlist the kagent-tools redaction-test fixture by file and line shape kagent-dev/tools internal/mcp/mcp_test.go carries a fake JWT-shaped constant (upstream #107) that is in upstream history and in krateo-agentiko/kagent-tools, so every PR there fails the secret scan and a fingerprint cannot cover it. Allowlisted with condition AND on that one path and that exact const line shape. Tested with gitleaks 8.30.1: both findings clear; a JWT-shaped value under another const name in the file, or const secret in another file, is still caught. The literal is being replaced upstream. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01TLFnUd6g7xhDXDvaho4rDW --- .github/workflows/security.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index cae243f..cc06a79 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -174,6 +174,24 @@ jobs: # Residual risk, accepted: a credential that literally ends in one of these extensions. '''^[A-Za-z0-9_.-]+\.(py|conf|cnf|ini|cfg|ya?ml|json|toml|sh|tpl)$''', ] + [[allowlists]] + description = "kagent-tools redaction-test fixture" + # kagent-dev/tools internal/mcp/mcp_test.go declares a fake JWT-shaped constant to prove a + # tool error never puts a credential on a span (upstream #107, ours). It is in upstream + # history (8fd3465) and in krateo-agentiko/kagent-tools (7162d6d), so a fingerprint cannot + # cover it. Scoped to that file AND that exact line shape (const secret, segments 17/11/3 + # after "eyJ"). The constant is being replaced upstream with a value that is not token-shaped. + # Tested with gitleaks 8.30.1: both findings clear; a JWT-shaped value under another + # const name in that file, or `const secret` in any other file, is still caught + # (Diego 2026-11-16). + condition = "AND" + regexTarget = "line" + paths = [ + '''(^|/)internal/mcp/mcp_test\.go$''', + ] + regexes = [ + '''^\s*const secret = "eyJ[A-Za-z0-9_-]{17}\.[A-Za-z0-9_-]{11}\.[A-Za-z0-9_-]{3}"\s*$''', + ] TOML # --redact keeps the secret out of the log and must stay. But on its own the job prints # "leaks found: N" and nothing else -- not the rule, the file, or the fingerprint -- so a