refactor(llm-security): build the secret table from vendored commons (secret-egress 0.3.0)
The 19 fixed credential shapes in pre-edit-secrets.mjs were regex literals; they now come from signatures/secret-egress.json in the vendored commons via a new scanners/lib/secret-egress.mjs. Policy-injected custom patterns (entries 20+) are unchanged and still appended by the hook. Measured before the swap, not assumed: all 19 positions compared for order, name, regex source and flags, plus recompilation identity, against the literal table sliced out of the module text. Zero divergences. Commons had reported the same result; that was their measurement, so this one was run anyway. STATE's expectation that the golden gate would go red on both table records and file sha256 was wrong: pre-edit-secrets.mjs is in neither PINNED_FILES nor WALKED_MODULES, so the table had no golden coverage at all and the swap moved nothing. Rather than leave the vendored data with only behavioural coverage, secret-egress.mjs joins WALKED_MODULES — walked, not pinned, since it inlines no regex of its own. Golden diff was 19 ADDED, 0 CHANGED, 0 REMOVED, each source byte-identical to the pre-swap literal; re-blessed. suite-counts.json untouched. Tests: coverage is derived from the loaded table, so an entry commons adds cannot arrive without an end-to-end probe. All 19 now block through the real hook and are asserted by label, which also pins the ordering contract (a Bearer-wrapped JWT must report as the header). Mutating the vendored JSON fires in both directions plus reorder: under-match (AKIA quantifier) reddens 3 hook tests + golden; over-match (Anthropic key truncated to its prefix) reddens the false-positive probe + golden; moving the JWT entry ahead of the Bearer entry reddens the ordering test. Suite 2231 tests / 2223 pass / 6 skipped. The two parallel-run failures (pre-compact size-cap, benchmark) pass alone — the known timing flakes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MGMv5ZTUhVzZtCCwRrNZG5
This commit is contained in:
parent
30dba2a457
commit
c9652a6d3d
7 changed files with 484 additions and 34 deletions
|
|
@ -2,7 +2,7 @@
|
|||
"artifact": "golden-pattern-dump",
|
||||
"schema": 1,
|
||||
"counts": {
|
||||
"regex": 83,
|
||||
"regex": 102,
|
||||
"table": 7,
|
||||
"file": 5
|
||||
},
|
||||
|
|
@ -505,6 +505,120 @@
|
|||
"source": "ignor(?:ez?|er?)\\s+(?:les?\\s+)?instructions?\\s+pr[e\\u00e9]c[e\\u00e9]dentes?",
|
||||
"flags": "i"
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[0].pattern",
|
||||
"source": "AKIA[0-9A-Z]{16}",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[1].pattern",
|
||||
"source": "(?:aws_secret(?:_access)?_key|AWS_SECRET(?:_ACCESS)?_KEY)\\s*[=:]\\s*['\"]?[0-9a-zA-Z/+=]{40}['\"]?",
|
||||
"flags": "i"
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[10].pattern",
|
||||
"source": "\\bAIza[0-9A-Za-z_-]{35}\\b",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[11].pattern",
|
||||
"source": "-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[12].pattern",
|
||||
"source": "JWT[_-]?SECRET\\s*[=:]\\s*['\"][^'\"]{8,}['\"]",
|
||||
"flags": "i"
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[13].pattern",
|
||||
"source": "https:\\/\\/(?:hooks\\.slack\\.com\\/services|discord(?:app)?\\.com\\/api\\/webhooks)\\/",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[14].pattern",
|
||||
"source": "(?:password|passwd|secret|token|api[_-]?key)\\s*[=:]\\s*['\"][^'\"]{8,}['\"]",
|
||||
"flags": "i"
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[15].pattern",
|
||||
"source": "[Bb]earer [A-Za-z0-9\\-._~+/]{20,}",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[16].pattern",
|
||||
"source": "(?:postgres|mysql|mongodb|redis):\\/\\/[^\\s]+@[^\\s]+",
|
||||
"flags": "i"
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[17].pattern",
|
||||
"source": "\\bsk-[A-Za-z0-9]{20}T3BlbkFJ[A-Za-z0-9]{20}\\b",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[18].pattern",
|
||||
"source": "\\beyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\b",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[2].pattern",
|
||||
"source": "(?:AccountKey|SharedAccessKey|sig)=[A-Za-z0-9+/=]{20,}",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[3].pattern",
|
||||
"source": "(?:client[_-]?secret|ClientSecret)\\s*[=:]\\s*['\"][^'\"]{8,}['\"]",
|
||||
"flags": "i"
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[4].pattern",
|
||||
"source": "Ocp-Apim-Subscription-Key\\s*[=:]\\s*['\"]?[0-9a-f]{32}['\"]?",
|
||||
"flags": "i"
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[5].pattern",
|
||||
"source": "(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36,}",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[6].pattern",
|
||||
"source": "npm_[A-Za-z0-9]{36}",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[7].pattern",
|
||||
"source": "\\bsk-ant-api03-[A-Za-z0-9_-]{93}\\b",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[8].pattern",
|
||||
"source": "\\bsk-proj-[A-Za-z0-9_-]{40,}\\b",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "regex",
|
||||
"key": "secret-egress:SECRET_PATTERNS[9].pattern",
|
||||
"source": "\\bgithub_pat_[A-Za-z0-9_]{82}\\b",
|
||||
"flags": ""
|
||||
},
|
||||
{
|
||||
"kind": "table",
|
||||
"key": "severity:OWASP_AGENTIC_MAP",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue