-
Notifications
You must be signed in to change notification settings - Fork 16
build: verify gem integrity at install time + green the unit-test baseline #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| dist/* | ||
| *.log | ||
| browserstack.err | ||
|
|
||
| # Local Bundler state. .bundle/config can carry settings that weaken install-time | ||
| # integrity checks (e.g. disable_checksum_validation), so it must never be committed. | ||
| .bundle/ | ||
| vendor/bundle/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| source "http://rubygems.org" | ||
| source "https://rubygems.org" | ||
| gem "minitest" | ||
| gem "rake" | ||
| gem "json" | ||
| # "json" is intentionally NOT listed: lib/ uses the `json` default gem that ships | ||
| # with Ruby, and the gemspec declares no dependency on it, so a third-party json | ||
| # build is a redundant build-time dependency (and a native extension) to pull in. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,28 @@ | ||
| GEM | ||
| remote: http://rubygems.org/ | ||
| remote: https://rubygems.org/ | ||
| specs: | ||
| json (1.8.3) | ||
| minitest (5.8.4) | ||
| rake (12.3.3) | ||
| drb (2.2.3) | ||
| minitest (6.0.6) | ||
| drb (~> 2.0) | ||
| prism (~> 1.5) | ||
| prism (1.9.0) | ||
| rake (13.4.2) | ||
|
|
||
| PLATFORMS | ||
| aarch64-linux | ||
| arm64-darwin-24 | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit]
Consider
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed on the substance — Deliberately not fixing it this round. Round-1 scope was explicitly "the lockfile itself needs no change", and this file is the pinned-digest artifact under review — churning its If you want it, the one-liner is |
||
| ruby | ||
| x86_64-linux | ||
|
|
||
| DEPENDENCIES | ||
| json | ||
| minitest | ||
| rake | ||
|
|
||
| CHECKSUMS | ||
| drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373 | ||
| minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1 | ||
| prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85 | ||
| rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701 | ||
|
|
||
| BUNDLED WITH | ||
| 1.11.2 | ||
| 2.7.1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,17 +8,28 @@ def setup | |
| @bs_local = BrowserStack::Local.new | ||
| end | ||
|
|
||
| # The tests below actually start the BrowserStackLocal binary and open a | ||
| # tunnel, so they need a valid BROWSERSTACK_ACCESS_KEY and network access. | ||
| # Skip them (instead of erroring) when no key is available so the rest of | ||
| # the suite stays green in credential-less environments such as CI. | ||
| def skip_without_credentials | ||
| skip 'requires BROWSERSTACK_ACCESS_KEY (live integration test)' if ENV['BROWSERSTACK_ACCESS_KEY'].to_s.empty? | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [for-human] Scope note: this PR carries two purposes, and the "green suite" result now rests on these skips. Not a defect — flagging it because the approver should make two calls consciously. The PR reuses the earlier
For what it's worth, the security substance of the change verifies cleanly: all four
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Acknowledged — no action taken, since both are approver calls rather than defects, and your framing of each is accurate. Confirming so it's clear I read it rather than skipped it:
Thanks also for verifying the digests and the |
||
| end | ||
|
|
||
| def test_check_pid | ||
| skip_without_credentials | ||
| @bs_local.start | ||
| refute_nil @bs_local.pid, 0 | ||
| end | ||
|
|
||
| def test_is_running | ||
| skip_without_credentials | ||
| @bs_local.start | ||
| assert_equal true, @bs_local.isRunning | ||
| end | ||
|
|
||
| def test_multiple_binary | ||
| skip_without_credentials | ||
| @bs_local.start | ||
| bs_local_2 = BrowserStack::Local.new | ||
| second_log_file = File.join(Dir.pwd, 'local2.log') | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[blocking]
prism 1.9.0carries a C extension, so the "no native extensions remain" claim is wrong — and that claim is what justified skipping the Linux verification.Two statements are inaccurate for this resolution:
json"drops one third-party build-time component and one native build from dev setup"Evidence —
prism 1.9.0, pulled in transitively byminitest 6.0.6(prism (~> 1.5), line 7):extensions: - ext/prism/extconf.rbrubyplatform only — there are no precompiledx86_64-linux/aarch64-linux/ darwin variants. That is consistent with this lockfile carrying a single genericprism (1.9.0)spec row and a single checksum entry, rather than per-platform rows.So every
bundle install— on all four platforms listed below — compiles prism from source and needs a C toolchain plus Ruby headers. The net native-build count is unchanged (jsonout,prismin), not reduced to zero. That matters here specifically because the stated reason for droppingjsonwas that its native extension fails to compile against Homebrewruby@3.2headers: the same class of failure is still in the dependency graph, just in a different gem, and on a gem that has no precompiled fallback at all.Consequence: the "linux platform rows resolve" human-verify item is load-bearing, not optional as recorded. It is a one-liner:
Fix: run that check, and correct the two claims (the PR body sentence, plus a follow-up note on the ticket). The lockfile itself needs no change — the spec rows and all four digests are correct, and I verified each digest independently against the SHA-256 rubygems.org publishes for that exact version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed and fixed — you're right on both counts, and thanks for catching that the false claim was the justification for skipping the check, not just a stray inaccuracy.
Verified independently before accepting:
prism-1.9.0.gemspec:15→s.extensions = ["ext/prism/extconf.rb"]ruby. No precompiled variant anywhere.vendor/bundle/ruby/3.2.0/extensions/arm64-darwin-24/3.2.0/prism-1.9.0/prism/prism.bundleSo net native-build count is unchanged (
jsonout,prismin), exactly as you said.drb/minitest/rakedo declare no extensions —prismwas the miss.Ran the check.
ruby:3.2, Ruby 3.2.11, Bundler 2.7.1:aarch64-linuxpasses — and thatwith native extensionsline is your point proven from the other direction.x86_64-linuxI could not settle, and I'm not claiming it passes. This is an arm64 host, so the amd64 container runs under qemu and segfaults inside the emulator while building prism's extension (rubygems/ext/ext_conf_builder.rb→open3.capture2e→qemu: uncaught target signal 11, exit 139). Emulation artifact, not a real-hardware verdict. I've left it as a load-bearing human-verify item rather than downgrade it again: on a real x86_64 box,gem install bundler:2.7.1 && bundle installshould giveBundle complete! 2 Gemfile dependencies, 5 gems now installed.Two notes for whoever runs that: your
-v "$PWD":/wone-liner needs a colon-free path (my session dir contained:, which is the-vdelimiter), and under qemu a Bundler error can surface as a segfault because thor'sdynamic_width_sttycrashes while printing it — setTHOR_COLUMNSif you see that.Corrected both claims: the PR body sentence now says removing
jsondrops a third-party component but does not make the graph extension-free, and spells out prism'sruby-only publication; the tracking-ticket comment was edited in place with an explicit "this was false" banner naming the original wording. Per your note I left the lockfile untouched.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Round 1 — resolved. Verified rather than accepted: I re-ran the evidence myself rather than checking that the wording changed.
The claim is corrected on both surfaces (PR body, and the ticket comment edited in place with a banner quoting the original wrong wording), and the corrections are themselves accurate —
extensions:is genuinely line 15 of prism's gemspec metadata, and 1.9.0 really is published for therubyplatform only.Reproduced locally on Ruby 3.2.10 / Bundler 2.7.1 (
BUNDLE_FROZEN=true, isolatedBUNDLE_PATH, clean checkout of524db87):5 gemsis correct, not an off-by-one. The lockfile has 4 specs; Bundler counts itself —cli/install.rb:119usesdefinition.specs.count, anddefinition.rb:621,628fold abundlerdependency into the resolution viadependencies_with_bundler. I checked this because 4-vs-5 was the one figure that would have indicated fabricated output.ext/prism/extconf.rb:127iscreate_makefile("prism/prism"), which is exactly why the built object lands at…/prism-1.9.0/prism/prism.<ext>. Mine:vendor/bundle/ruby/3.2.0/extensions/arm64-darwin-24/3.2.0/prism-1.9.0/prism/prism.bundle— same shape as the reported…/aarch64-linux/3.2.0/prism-1.9.0/prism/prism.so.Gemfile.lock— so the committed lockfile is complete for the locked platform and the pinned digests are accepted as-is.23 runs, 40 assertions, 0 failures, 0 errors, 3 skips.rakedigest aborts with exit 37, nothing installed, error anchored atGemfile.lock:25:17— the same line/column quoted in the PR body. Bundler's own error text suggestsbundle config set --local disable_checksum_validation true, which independently vindicates the.gitignoreprecaution.Leaving
x86_64-linuxopen is the right call and I'm not treating it as blocking: it's honestly labelled inconclusive rather than passing, the qemu segfault is a plausible emulation artifact on an arm64 host (ruby -vhere confirmsarm64-darwin24), prism built cleanly on bothaarch64-linuxandarm64-darwin-24, and nothing consumes those platform rows today since no workflow runsbundle install. The handoff carries a runnable command and an expected result.