Skip to content

fix(docker): move the image to Ruby 3.4.13 (CVE-2026-132825) - #34

Merged
Nandu-pns merged 1 commit into
mainfrom
fix/ruby-3.4-base-image
Nov 20, 2026
Merged

Nandu-pns merged 1 commit into
mainfrom
fix/ruby-3.4-base-image

Conversation

@Nandu-pns

@Nandu-pns Nandu-pns commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

The image ran Ruby 2.7.4, from Debian 11's ruby-full on top of python:3.10.8. Ruby 2.7 is EOL and affected by Ruby2Shell (CVE-2026-132825); the fixed releases are 3.3.14, 3.4.13 and 4.0.10. Updating gems doesn't help here. The interpreter in the image has to change.

This image (newrelic/deployer:latest) runs every E2E test in open-install-library (PR checks, daily regression, smoke and cleanup), so the goal is to change the interpreter without changing behavior.

Changes

  • Base image: python:3.10.8 → ruby:3.4.13-bookworm. Debian's own Ruby can't be used: bookworm ships 3.1.2 (EOL) and trixie 3.3.13, both below the fix. Python 3.11 now comes from Debian, in a venv (/opt/venv, on PATH), because Debian 12 blocks system-wide pip installs. Bookworm rather than the default trixie tag, because the pinned ansible-core==2.15.6 supports Python up to 3.11.
  • Ruby 3 compatibility:
    • File.exists? / Dir.exists? → exist?, removed in Ruby 3.2 (provisioner.rb, terminator.rb, installer.rb, the UAT spoofers)
    • open(url) → URI(url).open in command_line/provider.rb and install/packager.rb. open-uri stopped patching Kernel#open in Ruby 3.0. URI(...).open (rather than URI.open) can't fall back to Kernel#open, which would run a |cmd argument as a shell command (CodeQL rb/non-constant-kernel-open). Both paths only get http(s) URLs, which is why CI on Ruby 3.0.5 didn't catch them.
  • Gemfile: pin base64 0.2.0, mutex_m 0.3.0 and racc 1.8.1, the versions Ruby 3.4.13 ships. They're no longer default gems in 3.4, and aws-sdk-core, minitest and parser need them under Bundler. Gemfile.lock only gains these three; no other version changes, and it's still BUNDLED WITH 2.5.6.
  • One unit test (tests/deployment/aws/type_validator_factory_tests.rb) asserted on Ruby 2.7's NoMethodError text, which used to include the receiver. It now asserts on the missing method.
  • CI (test.yml) runs on Ruby 3.4.13 instead of 3.0.5.

Unchanged: Terraform 0.11.11, ansible-core 2.15.6, the Ansible collections and roles, the pip requirements, and the main.rb / batch.rb entry points and flags.

Testing

Image checks (built for linux/amd64, as publish.yml does):

  • Versions: ruby 3.4.13, Python 3.11.2 (/opt/venv), ansible-core 2.15.6, Terraform 0.11.11, Bundler 2.5.6, Debian 12
  • Ansible collections and roles at their pinned versions (amazon.aws 5.1.0, community.aws 5.0.0, azure.azcollection 1.18.1, google.cloud 1.0.2, newrelic.*)
  • A hosts: localhost playbook (like the provision templates) runs with /opt/venv/bin/python3 and imports boto3
  • rake test:unit: 848 runs, 1338 assertions, 0 failures, 0 errors, the same as the current image (Ruby 2.7.4)
  • main.rb and batch.rb load and print their options
  • URI(url).open returns the same content for https URLs and rejects a |cmd argument, where URI.open would run it
  • CI: CodeQL, unit, integration and lint pass

End-to-end (open-install-library PR 1478, draft, not for merge): builds the image from this branch at 72cffaa (ruby 3.4.13) and runs three open-install-library tests that also passed in the same day's regression on the current image.

Test Covers Result
infra-agent/ubuntu24-infra.json Infra agent install ✅ Pass
logging/amazonlinux2023.json Targeted install (-n logs-integration) ✅ Pass
ohi/linux/rabbitmq-debian.json Service deploy (RabbitMQ), then install ✅ Pass

Each one runs provision → install → validation → teardown. All Ansible plays exit 0, with no errors.

publish.yml is manual, so merging doesn't change newrelic/deployer:latest. It gets republished separately, followed by an open-install-library E2E run.

Comment thread src/command_line/provider.rb Fixed
Comment thread src/install/packager.rb Fixed
The image ran Debian 11's Ruby 2.7.4 (python:3.10.8 + ruby-full), which is
EOL and affected by Ruby2Shell (CVE-2026-132825). Use ruby:3.4.13-bookworm
instead, with Python 3.11 from Debian in a venv for Ansible (ansible-core
2.15.6 supports Python up to 3.11, so not the default trixie tag).

Ruby 3 fixes needed by the new interpreter:
- File.exists? / Dir.exists? -> exist? (removed in Ruby 3.2)
- open(url) -> URI(url).open in the provider and packager. open-uri no
  longer patches Kernel#open since Ruby 3.0, and URI(...).open (not
  URI.open) cannot fall back to Kernel#open, which would run a "|cmd"
  argument as a shell command (CodeQL rb/non-constant-kernel-open).
- Gemfile: pin base64, mutex_m and racc to the versions Ruby 3.4.13 ships
  (no longer default gems; needed by aws-sdk-core, minitest and parser)
- One unit test asserted on Ruby 2.7's NoMethodError message text; assert
  on the missing method instead.

CI now runs the tests on Ruby 3.4.13 as well.
@Nandu-pns

Copy link
Copy Markdown
Collaborator Author

FYI for reviewers: the 3 failing cloud UAT checks (test-cloudprovider-aws, -azure, -gcp) aren't related to this PR. They already fail the same way on main. The image builds fine in all three jobs; the failures come from the test accounts and an existing Azure dependency issue, so they're not a blocker for this PR. The real end-to-end check passed on open-install-library instead (see the description).

@Nandu-pns
Nandu-pns merged commit 4c807c9 into main Nov 20, 2026
13 of 16 checks passed
@Nandu-pns
Nandu-pns deleted the fix/ruby-3.4-base-image branch November 20, 2026 17:03
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.

3 participants