Title: build: verify gem integrity at install time + green the unit-test baseline by 07souravkunda · Pull Request #42 · browserstack/browserstack-local-ruby · GitHub
Open Graph Title: build: verify gem integrity at install time + green the unit-test baseline by 07souravkunda · Pull Request #42 · browserstack/browserstack-local-ruby
X Title: build: verify gem integrity at install time + green the unit-test baseline by 07souravkunda · Pull Request #42 · browserstack/browserstack-local-ruby
Description: What this does
Two related things to the build/test dependency setup. Product code under lib/ is untouched.
Greens the pre-existing unit-test baseline so the suite installs and runs on a current Ruby.
Hardens gem install-time integrity — HTTPS source, a modern Bundler, and a CHECKSUMS
block so every bundle install verifies gem content against a pinned SHA-256.
Why the integrity part matters
Gemfile/Gemfile.lock on master fetched gems from http://rubygems.org with
BUNDLED WITH 1.11.2 (2016) and no CHECKSUMS block — so nothing verified the content
of a downloaded gem. rake executes arbitrary code from the Rakefile at test time, so a
substituted tarball would run as the developer.
Related advisory context: CVE-2020-8130 / GHSA-jppv-gw3r-w3q8 (OS command injection in
Rake::FileList, patched in rake 12.3.3). The old lockfile already pinned 12.3.3, so it was
not itself vulnerable; this PR moves to rake 13.4.2 and, more importantly, makes the delivery
of that gem verifiable.
What was failing (baseline on master)
bundle install failed outright, so no tests could run at all:
The http://rubygems.org source no longer serves the spec index over plain HTTP, so
resolution failed with Could not fetch specs from http://rubygems.org/.
The lockfile pinned json 1.8.3, minitest 5.8.4, rake 12.3.3 and BUNDLED WITH 1.11.2.
json 1.8.3 cannot compile its native extension on Ruby 3.x, and the ancient pinned Bundler
was force-installed on every run.
Once installable, the suite showed 3 errors out of 23 — all three start-based tests
(test_check_pid, test_is_running, test_multiple_binary). These download and launch the real
BrowserStackLocal binary and open a tunnel, so they need a valid BROWSERSTACK_ACCESS_KEY and
network access. That is an environment/credential dependency, not a product bug.
What changed
Gemfile — source switched to https://rubygems.org. Dropped gem "json": lib/ uses the
json default gem that ships with Ruby (only JSON.parse / JSON.dump), and the gemspec
declares no dependency on it, so a third-party json was a redundant build-time dependency —
and a native extension that fails to compile against Homebrew's ruby@3.2 headers
(static declaration of 'rb_hash_bulk_insert' follows non-static declaration). Removing it
drops one third-party build-time component.
It does not make the dependency graph extension-free: prism 1.9.0 — pulled in
transitively by minitest 6.0.6 (prism (~> 1.5)) — declares
extensions: ["ext/prism/extconf.rb"] and is published for the ruby platform only (no
precompiled x86_64-linux / aarch64-linux / darwin variants), so every bundle install
still compiles one C extension and needs a C toolchain plus Ruby headers. Net native-build
count is unchanged — json out, prism in. See the Linux check under Verification.
Gemfile.lock — regenerated with Bundler 2.7.1: HTTPS remote, current buildable
versions (minitest 6.0.6, rake 13.4.2), common Linux platforms for CI portability, and a
CHECKSUMS block with per-gem SHA-256 digests.
.gitignore — ignore .bundle/ and vendor/bundle/. .bundle/config can carry
disable_checksum_validation, which would silently switch the new verification off; it must
never be committed.
test/browserstack-local-test.rb — the three live integration tests skip when
BROWSERSTACK_ACCESS_KEY is absent, so the suite stays green in credential-less environments.
With a key set they run in full, unchanged.
Verification
Checksums are genuine. Each digest in CHECKSUMS was cross-checked against the SHA-256
rubygems.org publishes for that exact version (/api/v2/rubygems/
Open Graph Description: What this does Two related things to the build/test dependency setup. Product code under lib/ is untouched. Greens the pre-existing unit-test baseline so the suite installs and runs on a current R...
X Description: What this does Two related things to the build/test dependency setup. Product code under lib/ is untouched. Greens the pre-existing unit-test baseline so the suite installs and runs on a current R...
Opengraph URL: https://github.com/browserstack/browserstack-local-ruby/pull/42
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:d414aae0-6603-3a19-b474-c5d3a1428357 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BB32:19B98B:5FFC5C:8754C7:6B0478A7 |
| html-safe-nonce | 44200b00a0c3c214ed95d3f5ba84cfce7cdc142eb77f3c25f66a95f419e1570f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQjMyOjE5Qjk4Qjo1RkZDNUM6ODc1NEM3OjZCMDQ3OEE3IiwidmlzaXRvcl9pZCI6IjU1NzgyMzk1NDM3MTI0NDY2MzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 91667619ae6544ec3e808c89b00a632072f7c640164eb6b41ce82b23b35588ad |
| hovercard-subject-tag | pull_request:4229997871 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/browserstack/browserstack-local-ruby/pull/42/files |
| twitter:image | https://avatars.githubusercontent.com/u/50537259?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/50537259?s=400&v=4 |
| og:image:alt | What this does Two related things to the build/test dependency setup. Product code under lib/ is untouched. Greens the pre-existing unit-test baseline so the suite installs and runs on a current R... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9c099f1b85def81ca352464c276510dfef32deaf3c305404e65b8d270284a58b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/browserstack/browserstack-local-ruby git https://github.com/browserstack/browserstack-local-ruby.git |
| octolytics-dimension-user_id | 1119453 |
| octolytics-dimension-user_login | browserstack |
| octolytics-dimension-repository_id | 51922935 |
| octolytics-dimension-repository_nwo | browserstack/browserstack-local-ruby |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 51922935 |
| octolytics-dimension-repository_network_root_nwo | browserstack/browserstack-local-ruby |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cf73f57448d52b3a7b619195e182b33d3b3454ca |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width