fix(scripts): drift-check forbidden-content.ts's secret patterns against secret-patterns.ts (#8674) - #8729
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 #8729 +/- ##
=======================================
Coverage 93.79% 93.79%
=======================================
Files 797 797
Lines 79478 79478
Branches 24079 24079
=======================================
Hits 74543 74543
Misses 3563 3563
Partials 1372 1372
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 01:27:58 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.
|
|
LoopOver is closing this pull request on the maintainer's behalf (conflicts with the base branch — resolve and open a fresh PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Problem
Closes #8674.
scripts/forbidden-content.ts'sFORBIDDEN_CONTENTis a third hand-copy (#7433) of theHARD_SECRET_KINDSregex bodies insrc/review/secret-patterns.ts— 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 (guarded bySECRET_DETECTION_TWIN_PAIR), it was never registered incheck-engine-parity.ts'sNAMED_TWIN_PAIRS, so a tightened or addedHARD_SECRET_KINDSpattern would silently leave packaged tarballs scanning with a stale body — no CI signal.Fix
scripts/forbidden-content.tsas a newNamedTwinPair(FORBIDDEN_CONTENT_TWIN_PAIR) againstsrc/review/secret-patterns.tsinNAMED_TWIN_PAIRS.FORBIDDEN_CONTENT_MARKERS: the distinctive backslash-free core of eachHARD_SECRET_KINDSregex body forbidden-content copied exactly (13 kinds,aws_access_key…jwt). Anchoring on the inner body (not the\b/\.escapes, which necessarily differ between regex literals and string bodies) means a reformatted boundary never false-fails while a real change to a character class / length / watermark does.github_token/github_pat/private_key_blockare deliberately excluded — forbidden-content keeps its own looser pre-#7433 bodies for those three, a pre-existing intentional divergence that would false-fail, exactly asSECRET_DETECTION_MARKERSexcludes its own naming-divergent kinds.Tests
git diff --checkclean. (Rebased onto latest main after #8719 landed a gate-decision enhancement in the same files.)