Harden gemspec files list to an explicit git-tracked allowlist (herb-embedded-78l) - #52
Merged
Conversation
…embedded-78l) spec.files now builds from git ls-files filtered by per-directory regex (lib/**/*.rb, vendor/**/*.js, js/**/*.js, exe/* non-recursive) instead of Dir[] globs, per guides.rubygems.org/security's explicit recommendation: a pushed gem is public and widely mirrored, so a stray file matching a broad glob would ship with no review catching it before gem push, and a published version can only be yanked, not recalled. Verified byte-for-byte identical to the old file set (including correctly excluding js/entry.mjs, a git-tracked but non-.js build-time file the old glob never matched either), and confirmed via a real gem build + install + herb-lint-rb run that Bridge#boot's direct references to vendor/herb-linter.js and js/*.js still resolve correctly.
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
spec.filesnow builds fromgit ls-filesfiltered by per-directory regex (lib/**/*.rb,vendor/**/*.js,js/**/*.js,exe/*non-recursive) instead ofDir[]globs, per guides.rubygems.org/security's explicit recommendation: "Build your files list from explicit allowlists (likegit ls-files) rather than broad globs."gem push— and a published version can only be yanked, not recalled from whoever already has it.Acceptance criteria
spec.filesbuilt from a git-tracked allowlist, notDir[]globs.gem buildsucceeds and the resulting package's file list matches exactly what the currentDir[]-based gemspec produced — verified two ways: (1) a script comparing the old and new file sets directly on the repo (byte-for-byte identical, 22 files), specifically confirmingjs/entry.mjs(git-tracked but not.js, a build-time-only esbuild entry point) stays correctly excluded the same way the old glob excluded it; (2)bundle exec rake build+gem specification pkg/herb-embedded-0.10.3.0.gem fileson the actual built package.bundle exec rakepasses locally (206 examples, 0 failures, 0 RuboCop offenses) — plus a real end-to-end smoke test: installed the freshly-built.geminto the real gem environment and ranherb-lint-rbagainst a fixture, confirmingBridge#boot's direct file-path references tovendor/herb-linter.jsandjs/*.jsstill resolve correctly from the new file list.Test plan
bundle exec rakepasses locally.gem build→gem install→herb-lint-rb <fixture>round trip produces a correct diagnostic.🤖 Generated with Claude Code