fix(scripts): extend the packaged-secret detector with the repo's other precise secret formats#7499
Conversation
…er precise secret formats
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7499 +/- ##
=======================================
Coverage 91.41% 91.41%
=======================================
Files 717 717
Lines 73035 73035
Branches 21635 21635
=======================================
Hits 66765 66765
Misses 5227 5227
Partials 1043 1043
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-20 13:57:16 UTC
Review summary Nits — 3 non-blocking
Flagged checks (non-blocking)
Decision drivers
Context & advisory signals — never blocks the verdict
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.
|
What
Extends the packaged-secret detector
FORBIDDEN_CONTENT(scripts/forbidden-content.mjs) — the single source of truth thatcheck-miner-package.mjs/check-mcp-package.mjsuse to reject secret-like content in packed npm files, and thatminer-mcp-contract.test.tsuses to assert no MCP tool response leaks one — to also match the 12 concrete provider-key formats this repo already ships a tested regex for, but which this specific detector didn't cover.Closes #7433
Details
Added the exact regex bodies from
src/review/secret-patterns.ts'sSECRET_PATTERNSentries that are in itsHARD_SECRET_KINDS("near-zero false-positive") set, in addition to the 4 shapes already covered: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.Import vs. hand-copy: the issue asked to first check whether
scripts/**can import the patterns directly fromsecret-patterns.ts. It can't at runtime here —forbidden-content.mjsis a plain.mjsexecuted vianode(test:miner-pack/test:mcp-pack), andsecret-patterns.tsis TypeScript with no runtime.jssibling on that path, so anodeimportof it would fail. Per the issue's stated fallback,FORBIDDEN_CONTENTstays a singleRegExpand the exact pattern bodies are hand-copied in (composed vianew RegExp([...].join("|"))with a per-line comment naming each), with a header comment recording this reasoning.Deliberately excluded (with a code comment recording it):
jwt(out of scope for this issue) andseed_or_mnemonic/bittensor_key(documented insecret-patterns.tsas weak, false-positive-prone heuristics intentionally kept out ofHARD_SECRET_KINDS— an ordinarycoldkey:/hotkey =line or a "mnemonic" mention is not a leaked credential).No consumer changed:
check-miner-package.mjs,check-mcp-package.mjs, andminer-mcp-contract.test.tsneed zero edits — this is purely a widening of what the shared constant matches.Validation
test/unit/forbidden-content.test.tscases assertFORBIDDEN_CONTENT.test(...)istruefor one representative fixture per newly-added format (all fixtures assembled from fragments so this file never contains a contiguous credential-shaped literal, the same conventionsecret-patterns.test.tsuses), that the 5 pre-existing shapes still match, and that the excludedjwt/seed/bittensor shapes are NOT hard-blocked. 20/20 pass, and the new-format assertions are a real regression guard (they returnfalseagainst the pre-change regex,trueafter).npm run test:miner-pack,npm run test:mcp-pack— pass.miner-mcp-contract.test.ts— 33/33 pass.git diff --checkclean.(
scripts/**is excluded from Codecov's coverage list, so this carries nopatchobligation, but the behavior is pinned by the assertions above per this repo's testing discipline.)