fix(miner): restore the strict flat-only pack-safety allowlist#3781
Merged
Conversation
#3778 widened scripts/check-miner-package.mjs's ALLOWED regex to accept one level of subdirectory under lib/, to accommodate the calibration module's nested lib/calibration/{index,types}.{js,d.ts} layout from #3704. #3772 (merged minutes earlier, independently fixing the same main-red CI break) took the opposite approach: it flattened that module to lib/calibration.js + lib/calibration-types.js instead, matching every other module in the package. With the nested directory gone, #3778's widening is dead weight -- it permanently weakens a security-relevant pack-safety allowlist (the only guard against an arbitrary nested file sneaking into the published npm package) for zero remaining benefit. Restore the strict flat-only pattern and turn the now-obsolete "accepts a subdirectory" test into a rejection test, so a future nested lib/ file is caught here instead of requiring another regex widening.
Contributor
|
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 #3781 +/- ##
=======================================
Coverage 93.29% 93.29%
=======================================
Files 317 317
Lines 32368 32368
Branches 11872 11872
=======================================
Hits 30199 30199
Misses 1537 1537
Partials 632 632 🚀 New features to boost your workflow:
|
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
scripts/check-miner-package.mjs'sALLOWEDregex to accept one level of subdirectory underlib/, to accommodate the calibration module's nestedlib/calibration/{index,types}.{js,d.ts}layout added by chore(miner): scaffold calibration module types (#2332) #3704.lib/calibration.js+lib/calibration-types.js, matching every other module inpackages/gittensory-miner/lib/.git ls-tree -r origin/main -- packages/gittensory-miner/lib/shows zero subdirectory entries), fix(miner): accept lib/ subdirectory modules in the package checker #3778's widening is now dead weight — it permanently weakens a security-relevant pack-safety allowlist (the only guard against an arbitrary nested file sneaking into the published npm package) for zero remaining benefit.lib/file is caught here rather than requiring another regex widening.No issue filed — small, self-evident cleanup of a redundant, just-merged change.
Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not touchsite/,CNAME, or GitHub Pages.Validation
git diff --checknpm run actionlintnpm run typechecknpx vitest run test/unit/check-miner-package.test.ts— 8/8 passed, including the real-workspace-package test and both rejection cases (one-level and two-level nesting)npm audit --audit-level=moderatenpm run test:coveragein full — not run;scripts/**is excluded fromcodecov/patch(onlysrc/**is measured), and the directly affected test file was run in full aboveIf any required check was skipped, explain why:
scripts/check-miner-package.mjsand its dedicated test file, neither undersrc/**.Safety
Notes