-
Notifications
You must be signed in to change notification settings - Fork 67
Fix CVE-2026-33210: upgrade Ruby json gem in assemble, phylo, and mega images #1058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,7 +20,7 @@ | |||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Workaround: add sequip lib directory to PERL5LIB | ||||||||||||||||||||||||||||||
| # NOTE: sequip version here must match the version in requirements/assemble.txt | ||||||||||||||||||||||||||||||
| ENV PERL5LIB=$PERL5LIB:/opt/conda/share/sequip-0.11/lib | ||||||||||||||||||||||||||||||
|
Check warning on line 23 in docker/Dockerfile.assemble
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Copy requirements and dependency installation script | ||||||||||||||||||||||||||||||
| COPY docker/requirements/baseimage.txt docker/requirements/core.txt docker/requirements/assemble.txt docker/requirements/assemble-x86.txt /tmp/requirements/ | ||||||||||||||||||||||||||||||
|
|
@@ -28,11 +28,16 @@ | |||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Install conda dependencies (assembly tools) | ||||||||||||||||||||||||||||||
| # All files resolved together in single micromamba call; x86-only files skipped on ARM | ||||||||||||||||||||||||||||||
| # Remove mafft's dash_client (Go 1.22.1 binary with 11 Go stdlib CVEs) — we | ||||||||||||||||||||||||||||||
| # never use --dash mode; delete inline so it never appears in any layer. | ||||||||||||||||||||||||||||||
| # Post-install fixups (inline so vulnerable files never appear in a committed layer): | ||||||||||||||||||||||||||||||
| # - mafft's dash_client: Go 1.22.1 binary with Go stdlib CVEs; we never use --dash mode | ||||||||||||||||||||||||||||||
| # - Ruby json gem: mummer4/sequip pull in Ruby (via yaggo), whose bundled json gem | ||||||||||||||||||||||||||||||
| # has CVE-2026-33210; remove the old default gem and install patched version (>=2.19.2) | ||||||||||||||||||||||||||||||
| RUN /tmp/install-conda-deps.sh /tmp/requirements/baseimage.txt /tmp/requirements/core.txt /tmp/requirements/assemble.txt \ | ||||||||||||||||||||||||||||||
| --x86-only:/tmp/requirements/assemble-x86.txt && \ | ||||||||||||||||||||||||||||||
| rm -f /opt/conda/libexec/mafft/dash_client | ||||||||||||||||||||||||||||||
| rm -f /opt/conda/libexec/mafft/dash_client && \ | ||||||||||||||||||||||||||||||
| find /opt/conda/lib/ruby -maxdepth 3 -name 'json*' -not -path '*/psych/*' -exec rm -rf {} + && \ | ||||||||||||||||||||||||||||||
| rm -f /opt/conda/lib/ruby/gems/*/specifications/default/json-*.gemspec && \ | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
| rm -f /opt/conda/lib/ruby/gems/*/specifications/default/json-*.gemspec && \ | |
| RUBY_GEM_DIRS="$(ruby -e 'print Gem.default_dir' 2>/dev/null || true) $(gem env gemdir 2>/dev/null || true)" && \ | |
| for d in $RUBY_GEM_DIRS; do \ | |
| if [ -d "$d" ]; then \ | |
| rm -rf "$d"/gems/json-* "$d"/cache/json-* "$d"/specifications/json-*.gemspec "$d"/extensions/*/*/json-* 2>/dev/null || true; \ | |
| rm -f "$d"/specifications/default/json-*.gemspec 2>/dev/null || true; \ | |
| fi; \ | |
| done && \ |
Copilot
AI
Mar 31, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These paths are hard-coded to /opt/conda/lib/ruby/.... To make this resilient to Ruby version / conda layout changes, consider deriving the RubyGems directory dynamically (e.g., via gem env gemdir or ruby -e 'print Gem.default_dir') and performing removals relative to that, rather than assuming /opt/conda/lib/ruby/gems/*/... exists.
| find /opt/conda/lib/ruby -maxdepth 3 -name 'json*' -not -path '*/psych/*' -exec rm -rf {} + && \ | |
| rm -f /opt/conda/lib/ruby/gems/*/specifications/default/json-*.gemspec && \ | |
| RUBY_LIB_DIR="$(ruby -e 'require \"rbconfig\"; print RbConfig::CONFIG[\"rubylibdir\"]')" && \ | |
| RUBY_GEM_DIR="$(ruby -e 'print Gem.default_dir')" && \ | |
| find "$RUBY_LIB_DIR" -maxdepth 3 -name 'json*' -not -path '*/psych/*' -exec rm -rf {} + && \ | |
| rm -f "$RUBY_GEM_DIR"/specifications/default/json-*.gemspec && \ |
Copilot
AI
Mar 31, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure the vulnerability fix actually takes effect (and catch cases where gem install silently installs a different version than expected), consider adding a build-time assertion right after installation (e.g., requiring json and checking JSON::VERSION is >= 2.19.2). This keeps the Docker build from succeeding with the old default gem still being used.
| gem install json --version '>=2.19.2' --no-document | |
| gem install json --version '>=2.19.2' --no-document && \ | |
| ruby -e "require 'rubygems'; require 'json'; min = Gem::Version.new('2.19.2'); if Gem::Version.new(JSON::VERSION) < min; abort(\"json gem version #{JSON::VERSION} is less than required #{min}\"); end" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description says this affects
assemble,phylo, andmegacontainers, but this change is only inDockerfile.assemble.Dockerfile.megaandDockerfile.phyloboth build directly FROMmain-coreand run their owninstall-conda-deps.shstep, so they will not pick up this json-gem cleanup unless the same fix is applied there (notablymegainstallsassemble.txt, which is wheresequipis pulled in).