fix(deps): bump sinatra to >=4.2.0 (GHSA-mr3q-g2mv-mr4q)#390
Draft
fix(deps): bump sinatra to >=4.2.0 (GHSA-mr3q-g2mv-mr4q)#390
Conversation
Resolves: - GHSA-mr3q-g2mv-mr4q (low) -- sinatra reflected file download via User-Agent header (first patched in 4.2.0) AT: babysit-2026-04-25-05-46-47
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.
cc80d33f)Summary
Fixes 1 LOW severity 3PP vulnerability in
sinatra(GHSA-mr3q-g2mv-mr4q).Sinatra is vulnerable to a reflected file download via a crafted
User-Agentheader: when an attacker controls the UA string, Sinatra can be coerced into emitting it unsanitized into a response such that browsers treat the download as originating from the server. First patched insinatra 4.2.0.Production risk: Runtime
This vulnerability is reachable in production.
sinatrais the web framework servingweb.rbon the running dyno; any request path that reflects or logs theUser-Agentheader exercises the vulnerable code. Priority: LOW (severity), but production-reachable.Strategy: upgrade (direct dependency bump)
Changes
Gemfile
Bumped the
sinatragem constraint to admit the patched minor:Why a direct bump (not an override)?
sinatrais a direct dependency inGemfile(the app's web framework). The simplest correct fix is to move the constraint to the patched minor series. Bundler has no first-class override mechanism equivalent to npmoverrides/ pnpmpnpm.overrides, so for direct deps the canonical remediation is to bump theGemfilepin and let Bundler re-resolve transitives.Gemfile.lock
Re-resolved via
bundle update sinatra --conservativeso the upgrade is scoped tosinatraand its pinned transitives:sinatra: 4.1.1 -> 4.2.1rack-protection: 4.1.1 -> 4.2.1 (pinned by sinatra)rack-session: 2.1.1 -> 2.1.2 (transitive)mustermann: 3.0.3 -> 3.1.1 (transitive)tilt: 2.6.1 -> 2.7.0 (transitive)Why
--conservative? Prevents Bundler from drifting unrelated gems (puma,rackup,thin, etc.) that the advisory does not require touching. Keeps the lockfile delta scoped to what the CVE actually needs.Resolutions and overrides
None. Bundler does not use a
pnpm.overrides/resolutions/npm overridesfield; this fix is a directGemfileversion bump with a matchingGemfile.lockre-resolution. There are no override rows to register.How to test
This repository is a Sinatra-backed static content site (
web.rb+views/+content/). There is no automated test suite (confirmed: nospec/,test/, orRakefiletest task).Manual verification steps a reviewer or downstream consumer should exercise:
bundle install-- must re-resolve cleanly against the updatedGemfile.lock.bundle exec ruby -c web.rb-- syntax check on the Sinatra app.bundle exec rackup(orheroku local webviaProcfile) -- boot the app locally and confirm it serves/and a localized path (e.g./ja/) without exceptions.web.rb(get,before,set,redirect, ERB rendering,i18n) is stable across 4.1 -> 4.2; no caller changes required. Spot-check by hitting a few locale routes defined inweb.rb.User-Agentheader.web.rbdoes not currently echorequest.user_agentinto a response, so the app's concrete exposure is limited to whatever Sinatra itself does internally -- the upgrade closes that path regardless.Vulnerabilities Fixed
Validation
Validation is a before/after comparison. This PR's body-refresh pass re-ran validation against the already-fixed branch to capture fresh exit codes.
bundle update sinatra --conservativeexit 0 during original fix)ruby -c web.rbexit 0; log at.logs/babysit-rebody-validate-1777139521.log)bundle install)Notes
Gemfile) ->sinatra(direct). No transitive hop; the vulnerable package is a direct dependency.pnpm.overridesanalogue, so no Override Registry update is required and no README registry row is added.Gemfile(3.3.5via.ruby-version) is unchanged by this PR. Local validation on a machine with Ruby 3.2.2 reports the pin mismatch cosmetically but does not affect the correctness of the lockfile resolution.skill-sig:
26cfcbaf· grackle-sig:cc80d33f· 3pp-skill canonical pipeline · 3pp-grackle babysit