fix(scripts): drift-check forbidden-content.ts's secret patterns against secret-patterns.ts (#8674) - #8736
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…atterns against secret-patterns.ts scripts/forbidden-content.ts's FORBIDDEN_CONTENT is a THIRD hand-copy (JSONbored#7433) of secret-patterns.ts's HARD_SECRET_KINDS regex bodies -- consumed by the four package-manifest checkers (check-mcp/miner/engine/ ui-kit-package.ts) to reject a packed tarball embedding a provider secret. Unlike the REES copy (already guarded by SECRET_DETECTION_TWIN_PAIR), it was never registered in check-engine-parity.ts's NAMED_TWIN_PAIRS, so a tightened or added HARD_SECRET_KINDS pattern would silently leave packaged tarballs scanning with a stale body, with no CI signal. Register scripts/forbidden-content.ts as a new named twin pair against src/review/secret-patterns.ts, with a marker set covering the distinctive backslash-free core of each HARD_SECRET_KINDS regex body forbidden-content hand-copied exactly (13 kinds, aws through jwt). github_token/github_pat/private_key_block are deliberately excluded -- forbidden-content keeps its own looser pre-JSONbored#7433 bodies for those three, a pre-existing intentional divergence that would false-fail, exactly as SECRET_DETECTION_MARKERS excludes its own naming-divergent kinds. Tests: a drift-fail case proving a dropped shared body fails presence, plus assertions of the pair's identity and the three deliberate exclusions. The existing 'all named pairs pass against the real repo' regression test now also covers this pair (all 13 markers verified present in both live files -- no false positive).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8736 +/- ##
==========================================
+ Coverage 90.56% 93.80% +3.24%
==========================================
Files 96 797 +701
Lines 22490 79508 +57018
Branches 3884 24094 +20210
==========================================
+ Hits 20367 74584 +54217
- Misses 1945 3555 +1610
- Partials 178 1369 +1191
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-26 05:09:28 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Problem
Closes #8674.
scripts/forbidden-content.ts'sFORBIDDEN_CONTENTis a third hand-copy (#7433) of theHARD_SECRET_KINDSregex bodies insrc/review/secret-patterns.ts— used by the four package-manifest checkers to reject a packed tarball embedding a provider secret. Unlike the REES copy, it was never incheck-engine-parity.ts'sNAMED_TWIN_PAIRS, so a tightened/addedHARD_SECRET_KINDSpattern would silently leave packaged tarballs scanning with a stale body.Fix
Register
forbidden-content.tsas a newNamedTwinPairagainstsecret-patterns.ts, withFORBIDDEN_CONTENT_MARKERScovering the distinctive backslash-free core of each of the 13 exactly-copiedHARD_SECRET_KINDSbodies (aws_access_key…jwt).github_token/github_pat/private_key_blockare deliberately excluded (forbidden-content keeps looser pre-#7433 bodies for those — a false-fail otherwise), mirroring howSECRET_DETECTION_MARKERSexcludes its own divergent kinds.Tests
A drift-fail case + identity/exclusion assertions; the existing 'all named pairs pass against the real repo' guard now also covers this pair (13 markers verified present in both live files).
git diff --checkclean. Rebased onto latest main (past #8719 and #8723's parity changes).