fix(scripts): extend forbidden-content.mjs with the repo's other known-precise secret formats - #7537
Closed
claytonlin1110 wants to merge 1 commit into
Closed
Conversation
…n-precise secret formats FORBIDDEN_CONTENT (the packaged-secret detector used by check-miner-package.mjs, check-mcp-package.mjs, and miner-mcp-contract.test.ts) only matched 4 shapes, even though this repo already ships a materially larger, individually-verified-precise set of concrete secret-format patterns in src/review/secret-patterns.ts's SECRET_PATTERNS. Hand-copy the 12 missing HARD_SECRET_KINDS patterns' exact regex bodies in (plain node can't resolve secret-patterns.ts's .ts import, unlike check-engine-parity.ts which runs via tsx) rather than import them. jwt, seed_or_mnemonic, and bittensor_key are deliberately left out -- jwt is out of scope for this issue, and the other two are documented upstream as weak, false-positive-prone heuristics. Closes JSONbored#7433
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
JSONbored
reviewed
Jul 20, 2026
JSONbored
left a comment
Owner
There was a problem hiding this comment.
Merge conflicts/issue already resolved, closing.
This branch has conflicts that must be resolved
Use the [web editor](https://github.com/JSONbored/loopover/pull/7537/conflicts) or the command line to resolve conflicts before continuing.
scripts/forbidden-content.mjs
test/unit/forbidden-content.test.ts
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FORBIDDEN_CONTENT(scripts/forbidden-content.mjs) — the packaged-secret detector used bycheck-miner-package.mjs,check-mcp-package.mjs, andminer-mcp-contract.test.ts— only matched 4 secret shapes, even though this repo already ships a materially larger, individually-verified-precise set of concrete secret-format patterns insrc/review/secret-patterns.ts'sSECRET_PATTERNS.FORBIDDEN_CONTENTwith the 12 additional formats fromHARD_SECRET_KINDS(minusjwt):aws_access_key,slack_token,google_api_key,gitlab_token,npm_token,stripe_secret_key,sendgrid_key,huggingface_token,voyage_api_key,firecrawl_api_key,openai_api_key,anthropic_api_key— using the exact same regex bodies already defined for each.RegExprather than importing fromsrc/review/secret-patterns.ts.check-miner-package.mjs/check-mcp-package.mjsboth run via plainnode scripts/*.mjs(package.json'stest:miner-pack/test:mcp-pack), and plain Node cannot resolve a.tsimport (Unknown file extension ".ts", confirmed against this repo's Node 22 runtime) without a TS loader neither script registers — unlikescripts/check-engine-parity.ts, which runs viatsx. This is documented in a code comment onFORBIDDEN_CONTENT.jwt,seed_or_mnemonic, andbittensor_keywere deliberately not added:jwtis out of scope for this issue (noted in the code comment), andseed_or_mnemonic/bittensor_keyare documented insecret-patterns.tsas weak, false-positive-prone heuristics excluded fromHARD_SECRET_KINDSthere for the same reason (acoldkey:/hotkey =line or the word "mnemonic" in ordinary Bittensor docs is not a leaked credential).check-miner-package.mjs,check-mcp-package.mjs, orminer-mcp-contract.test.ts's call sites — this is purely a widening of what the shared constant matches.Tests
test/unit/forbidden-content.test.ts: added a parameterized case per new format (fixtures assembled from fragments, reusing the same fake bodiestest/unit/secrets-scan.test.ts/test/unit/content-lane-security-scan.test.tsalready use for these exact formats) plus a test pinning the 4 pre-existing formats as unchanged, and a test confirmingjwt/seed_or_mnemonic/bittensor_key-shaped values are deliberately NOT matched.test/unit/miner-mcp-contract.test.ts: extended the existing secret-shape assertion with a newly-added shape (aws_access_key) to confirm the widening actually reaches that consumer.@loopover/mcp/@loopover/minerfile lists (vianpm pack --dry-run --json) against all 12 new patterns directly — zero matches. Thecheck-mcp-package.test.ts/check-miner-package.test.ts"passes on the real workspace package" tests fail identically on a clean pre-change baseline in this environment (npm pack failed— a pre-existing WindowsspawnSyncissue unrelated to this change), confirmed via a throwawaygit worktreeat the pre-change commit.Validation
npx vitest run test/unit/forbidden-content.test.ts test/unit/miner-mcp-contract.test.ts— 54/54 passingnpx vitest run test/unit/secret-patterns.test.ts test/unit/secrets-scan.test.ts test/unit/content-lane-security-scan.test.ts— 169/169 passing (no regression in the sibling detectors this was copied from)npm run typecheck— clean (one pre-existing, unrelated error inpackages/loopover-miner/lib/discover-cli.tsconfirmed present on a cleanmainbaseline too)npm run test:engine-parity && npm run test:live-gate-parity && npm run test:driver-parity— all passingnpm run db:migrations:check && npm run db:schema-drift:check && npm run selfhost:env-reference:check && npm run miner:env-reference:check && npm run selfhost:validate-observability && npm run command-reference:check && npm run docs:drift-check && npm run manifest:drift-check— all cleannpm run cf-typegen:check— no driftnpm run actionlint— cleangit diff --check— cleanscripts/**andtest/**are excluded from Codecov'scoverage.includelist percodecov.yml, so this PR carries no patch-coverage obligation — the tests above are real behavioral assertions per this issue's own "Test Coverage Requirements" section, not for gate purposes.Closes #7433