Skip to content

Require oj 3.17.3 or newer to clear advisories - #94

Merged
bpurinton merged 1 commit into
masterfrom
bp-oj-security-pin
Nov 19, 2026
Merged

bpurinton merged 1 commit into
masterfrom
bp-oj-security-pin

Conversation

@bpurinton

@bpurinton bpurinton commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Why

bundle-audit reports eleven advisories against oj 3.13.23, one of them high severity (CVE-2026-54592). All are fixed in oj 3.17.3. This gem pins oj ~> 3.13.12, so none of the 103 Rails 8 project repos can take the fix while they depend on grade_runner 0.0.16.

This is the last piece of the gem security patch started in appdev-projects/rails-8-template#33 and now being carried out fleet-wide from project-syncing (firstdraft/project-syncing#58).

Change

  • oj pin: ~> 3.13.12 → ~> 3.17, >= 3.17.3
  • Version: 0.0.16 → 0.0.17

Gemfile.lock is left alone, as in #93.

Verification

  • oj 3.17.8 compiles and installs on Ruby 4.0.5 inside the phase 1 dev image.
  • The gem only calls Oj.dump and Oj.load, on RSpec output and on Grades responses. A sample of both gives byte-identical results under 3.13.23 and 3.17.8.

Tested end to end

After merge

Publish 0.0.17 to RubyGems. The project-syncing image locks and the project repos then pick it up; their Gemfiles already say ~> 0.0.16, which allows it.

bundle-audit reports eleven advisories against oj 3.13.23, one of them
high severity (CVE-2026-54592), all fixed in oj 3.17.3. grade_runner
pinned oj to "~> 3.13.12", so no project that uses this gem could take
the fix: every one of the 103 Rails 8 project locks was stuck on
3.13.23 for as long as it depended on grade_runner 0.0.16.

Move the pin to "~> 3.17", ">= 3.17.3" and bump to 0.0.17. The gem
only calls Oj.dump and Oj.load on RSpec output and on Grades
responses; both give byte-identical results under 3.13.23 and 3.17.8
on Ruby 4.0.5, checked inside the phase 1 dev image.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T19:16:41.014305Z dd1e03f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@bpurinton

Copy link
Copy Markdown
Contributor Author

Review and local testing

Good to merge. Moving to oj 3.17.8 clears the advisories and doesn't change anything grade_runner sends or receives.

End to end in a Codespace

I ran grade in getting-started-with-scaffolds (Ruby 4.0.5), opened from the lesson's launch button, first on the published gem and then on this branch:

Baseline This branch
Versions loaded grade_runner 0.0.16, oj 3.13.23 grade_runner 0.0.17, oj 3.17.8
Grades build #13 #14
Summary 16 tests, 16 failures, 0/16 points, 0.0% same
Errors or warnings none none
  • bundle install printed the expected lines: Using grade_runner 0.0.17 (was 0.0.16) … (at bp-oj-security-pin@dd1e03f) and Installing oj 3.17.8 (was 3.13.23) with native extensions.
  • Both builds list the same examples with the same states, and the recorded score is unchanged.
  • I compared the two RSpec results files that grade wrote to tmp/output/. They match apart from run times and Ruby object ids.

Locally

  • Dependency resolution: I re-resolved the rails8-phase1 image Gemfile against this branch with bundle lock --conservative --update grade_runner oj. The only lock changes are grade_runner itself and oj 3.13.23 → 3.17.8, which adds bigdecimal >= 3.0, already in the bundle. bundle-audit goes from 11 oj advisories, including the high-severity CVE-2026-54592, to none in the whole lock. All 11 list >= 3.17.3 as the fix, so the new floor is exactly right.
  • Formatter output: I ran a sample suite through JsonOutputFormatter on master with oj 3.13.23 and on this branch with oj 3.17.8. It had passing, failing, pending and erroring examples, with points, hints, unicode and escaped characters. Apart from timings, both runs wrote the same output.
  • Submission path: I checked reading the results file back with Oj.load, the JSON body Runner posts (with the HTTP call stubbed), and parsing the kinds of responses Grades returns. All three give identical results under both versions.
  • Warnings: there are no new ones under ruby -W.

Notes (none block the merge)

  1. Out-of-date committed lock. Gemfile.lock still pins oj (3.13.23), and it ships inside the gem because it's listed in s.files. Scanners that read lockfiles inside installed gems, such as Trivy on the dev image, may keep flagging oj there. Refreshing the lock isn't simple: the Gemfile's bundler ~> 2.1.4 development dependency stops it resolving on Bundler 4. Dropping Gemfile.lock from s.files may be the easier fix.
  2. Object mode (already true before this PR). Oj.load runs in oj's default :object mode, which still turns ^o/^c keys into Ruby objects on 3.17.8. That applies to Grades responses and to the RSpec results file. Tightening it means changing Oj.dump in the formatter too, since it relies on object mode to write ":key" symbol keys. That belongs in a separate change.
  3. Minor: the gemspec header comment still says grade_runner 0.0.13.

@bpurinton
bpurinton merged commit 4469c44 into master Nov 19, 2026
@bpurinton
bpurinton deleted the bp-oj-security-pin branch November 19, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant