Fix 3 of the 4 Grype-blocking advisories (the 4th needs a Ruby upgrade) - #4242
Open
tas50 wants to merge 2 commits into
Open
Fix 3 of the 4 Grype-blocking advisories (the 4th needs a Ruby upgrade)#4242tas50 wants to merge 2 commits into
tas50 wants to merge 2 commits into
Conversation
The Grype scan gates CI on high/critical findings and is currently failing on main and on every open PR, with four blocking advisories in src/oc-id/Gemfile.lock: Critical GHSA-xr9x-r78c-5hrm activestorage 7.2.3.1 -> 7.2.3.2 High GHSA-2x63-gw47-w4mm websocket-driver 0.8.0 -> 0.8.2 High GHSA-98m9-hrrm-r99r faraday 2.14.1 -> 2.14.3 High GHSA-c4rq-3m3g-8wgx nokogiri 1.18.9 -> 1.19.3 faraday is already handled by chef#4239 and nokogiri by chef#4177, so this change covers only the two with no PR open. activestorage is not directly declared; it comes from the exact rails pin, so the pin moves 7.2.3.1 -> 7.2.3.2. That is a patch release within the same 7.2.3 series. websocket-driver is pulled in transitively by actioncable (>= 0.6.1), so a direct floor is what moves it forward. It follows the existing concurrent-ruby precedent in this Gemfile: a bare floor rather than a SafeVersions constant, because no ruby_gems_cleanup.rb consumer exists for the gem and there is therefore nothing for SafeVersions to keep in sync. Dependabot opened chef#4223 for this gem and closed it believing websocket-driver was no longer a dependency; it is still in the lock at line 747 and still reachable through actioncable. The lock also moves globalid 1.3.0 -> 1.4.0, jbuilder 2.14.1 -> 2.15.1 and responders 3.2.0 -> 3.2.1. These are not incidental staleness: a plain re-resolve of main's Gemfile is byte-identical to the committed lock, so the lock was current. They move because they depend on the Rails subtree, and re-resolving it lets them float to the newest version their existing Gemfile requirements already allow. The same three move under bundle lock, --update --conservative and --conservative --strict alike, so this is the resolver's minimal answer rather than a flag choice. The lock was regenerated with bundler 2.3.27 on ruby 3.1 under linux/amd64 to match BUNDLED WITH and the x86_64-linux platform already recorded, so PLATFORMS and BUNDLED WITH are unchanged, as are the rack/rexml/net-imap floors in DEPENDENCIES. Re-running the resolve on the result reproduces it byte for byte. Verified by running Grype against src/oc-id the same way CI does (--only-fixed): the activestorage critical and the websocket-driver high are gone, and the only high findings left are the faraday and nokogiri ones that chef#4239 and chef#4177 address. Signed-off-by: Tim Smith <tim@mondoo.com>
Extends this PR to cover the third of the four Grype-blocking advisories, GHSA-98m9-hrrm-r99r. faraday 2.14.1 is present in both src/oc-id/Gemfile.lock and src/chef-server-ctl/Gemfile.lock, so both need the floor; fixing only one still trips the gate. This duplicates chef#4239, which addresses the same advisory the same way. The resulting Gemfile.lock diffs here are byte-identical to that PR's. Whichever lands first, the other can be dropped. The fourth advisory, GHSA-c4rq-3m3g-8wgx (nokogiri), is deliberately not addressed, because it cannot be fixed on the Ruby this product pins: nokogiri 1.18.9 required_ruby_version >= 3.1, < 3.5 (current) nokogiri 1.19.3 required_ruby_version >= 3.2 (the fix) omnibus_overrides.rb: override :ruby, version: "3.1.7" Adding a >= 1.19.3 floor makes the resolve fail outright: Bundler found conflicting requirements for the Ruby version: In Gemfile: nokogiri (>= 1.19.3) was resolved to 1.19.4, which depends on Ruby (>= 3.2) Current Ruby version: Ruby (= 3.1.7) That advisory needs a Ruby 3.2+ upgrade first, which is well outside the scope of a dependency bump. It also explains why chef#4177 has been open since May without merging: it edits a nokogiri line that no longer exists on main (removed in chef#4189), and the version it moves to could not resolve on Ruby 3.1 regardless. Verified by running Grype over the whole tree the way CI does (dir:. --only-fixed). Before: 1 critical, 3 high. After: 0 critical, 1 high -- the nokogiri finding above. Signed-off-by: Tim Smith <tim@mondoo.com>
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.
Problem
The
Grype scanjob gates CI on high/critical findings and is failing onmainand on every open PR. Four advisories block it:Because the gate trips on any high/critical in the tree, and each existing PR fixes only one advisory, #4239, #4177 and this PR were all failing the same check — none could go green alone. This PR fixes the first three.
Result: 1 critical + 3 high → 0 critical + 1 high.
Changes
activestorage isn't declared directly — it comes from the exact
railspin, so the pin moves to the patch release in the same series:websocket-driver is transitive via
actioncable (>= 0.6.1), so a direct floor moves it forward. Dependabot opened #4223 for it and closed it saying "Looks like websocket-driver is no longer a dependency" — that isn't right; it's still in the lock at line 747, still reachable throughactioncable.faraday needs the floor in both
src/oc-idandsrc/chef-server-ctl— fixing only one still trips the gate. This duplicates #4239; theGemfile.lockdiffs here came out byte-identical to that PR's. Whichever lands first, the other can be dropped.All floors follow the existing
concurrent-rubyprecedent — a bare floor rather than aSafeVersionsconstant, since there's noruby_gems_cleanup.rbconsumer for these gems and so nothing forSafeVersionsto keep in sync.The fourth advisory can't be fixed on the pinned Ruby
nokogiri is deliberately not addressed here:
required_ruby_version>= 3.1, < 3.5>= 3.2omnibus_overrides.rbpinsoverride :ruby, version: "3.1.7". Adding a>= 1.19.3floor fails the resolve outright:So GHSA-c4rq-3m3g-8wgx needs a Ruby 3.2+ upgrade first, which is far outside a dependency bump. Until then the Grype gate cannot reach zero.
This also explains #4177: it edits
gem 'nokogiri', '1.18.9', platforms: :ruby, a line that no longer exists on main (removed by #4189) — hence the conflict — and the version it moves to could not resolve on Ruby 3.1 anyway. Worth closing.Separately, #4189 dropping that line also dropped its
platforms: :rubyguard ("Force Ruby platform to avoid glibc compatibility issues" from #4043), so the lock now resolves the precompiledx86_64-linuxvariant whileomnibus_overrides.rbstill pinsoverride :nokogiri, version: "1.18.9". That may be worth a look on its own.About the three extra gems in the oc-id lock diff
The lock also moves
globalid 1.3.0 → 1.4.0,jbuilder 2.14.1 → 2.15.1,responders 3.2.0 → 3.2.1.Not incidental staleness — I checked: a plain re-resolve of
main's Gemfile is byte-identical to the committed lock. They move because they depend on the Rails subtree, and re-resolving it lets them float to the newest version their existing requirements already allow. The same three move underbundle lock,--update --conservativeand--conservative --strictalike. Happy to pin them back if you'd rather hold them.Verification
linux/amd64, matching theBUNDLED WITHandx86_64-linuxplatform already recorded.PLATFORMS,BUNDLED WITHand therack/rexml/net-imapfloors inDEPENDENCIESare unchanged in both.dir:. --only-fixed): before 1 critical + 3 high, after 0 critical + 1 high (the nokogiri finding above).Caveat
oc-idis a Rails app and I could not run its suite here, so the Rails patch bump and the three transitive bumps are unvalidated beyond dependency resolution. Worth a green test run before merge.