fix(scripts): don't reject miner package source files merely named with "secret"#8266
Conversation
…th "secret" check-miner-package.ts's FORBIDDEN_PATH filter matched the keyword "secret" (or "private...key") anywhere in a path, including inside legitimately-named .js/.ts source files -- caught while shipping PR #8263, whose tenant-secret-resolution.ts had to be renamed to tenant-credential-resolution.ts to work around it. Splits the filter: exact-name dotfiles (.env/.npmrc/.dev.vars) stay forbidden regardless of extension, and the keyword heuristic now only applies to non-source files. Source files are exempt because a real leaked secret VALUE is already caught unconditionally by the separate FORBIDDEN_CONTENT scan regardless of filename -- the keyword check was only ever a coarse, filename-based backstop for stray credential-shaped files like .pem/.json.
|
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 #8266 +/- ##
=======================================
Coverage 92.15% 92.15%
=======================================
Files 786 786
Lines 78860 78860
Branches 23801 23800 -1
=======================================
Hits 72676 72676
Misses 5062 5062
Partials 1122 1122
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-23 17:12:43 UTC
Review summary Nits — 1 non-blocking
Concerns raised — review before merging
📋 Copy for AI agents — paste into your coding agentDecision 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.
|
Summary
scripts/check-miner-package.ts'sFORBIDDEN_PATHfilter matched the keywordsecret(orprivate...key) anywhere in a packed file's path -- including inside a legitimately-named.js/.tssource file whose purpose is implementing secret-handling logic, not a file that itself contains a leaked value.Caught firsthand while shipping #8263: a new file named
tenant-secret-resolution.tsfailedtest/unit/check-miner-package.test.ts > passes on the real miner workspace packagepurely because of its name, and had to be renamed totenant-credential-resolution.tsto unblock that PR. This fixes the filter itself instead of leaving every future contributor to rediscover the same trap.Fix
Splits the filter into two concerns:
.env,.npmrc,.dev.vars) stay forbidden regardless of extension -- these files' entire purpose is almost always credentials.secret,private...key,.pem) now only applies to non-source files..js/.ts(including.d.ts) are exempt.This doesn't weaken real protection: a genuinely leaked secret value in any file, source or not, is already caught unconditionally by the separate
FORBIDDEN_CONTENTscan (scripts/forbidden-content.ts, applied to every packed file's content regardless of extension or name). The keyword-basedFORBIDDEN_PATHcheck was only ever a coarse, filename-based backstop aimed at stray credential-shaped files like.pem/secrets.json-- it was never meant to (and shouldn't) block descriptively-named source code.Tests
my-private-key.pem,config/secrets.json) is still rejected..env/.npmrc/.dev.vars) are still rejected regardless of this change.Verified:
tsc --noEmit --incremental falseclean, realnpx tsx scripts/check-miner-package.tsdry-run against the actual workspace passes, fulltest/unit/check-miner-package.test.tssuite green (17/17, up from 14),git diff --checkclean.Test plan
tsc --noEmit --incremental falsenpx tsx scripts/check-miner-package.ts(real dry-run)npx vitest run test/unit/check-miner-package.test.ts(17/17)git diff --check