Repository navigation
fix(security): size the scanner worker for grype and say when it runs out of memory - #1513
Merged
Merged
Conversation
The scanner worker memory limit was hardcoded at 512 MiB, so Grype could be OOM-killed on large images and the only symptom was 'exited with status 137' with no hint. DD_SECURITY_WORKER_MEMORY now sets the limit (integer with optional b/k/m/g suffix, minimum 6m, default 512m) and is passed through the hardening options. A 137 exit now inspects the worker before removal and reports an OOM kill, or 'most likely out of memory', with the configured limit and the setting name. Docs and changelog updated, and the docs now note that scan errors follow DD_SECURITY_AVAILABILITY_POLICY. Refs #1281
Profiling Grype under rc.8 on Colima: postgres:16 passed at 384 MiB, node:22 needed 768 MiB and nextcloud:30 about 900 MiB, so the old 512 MiB default OOM-killed common large images with exit 137. Refs #1281
…g below it Grype's JSON for large images (nextcloud:30 is about 60 MB) overran the hardcoded 50 MiB capture and 20 MiB parse limits. DD_SECURITY_GRYPE_MAXOUTPUTBYTES now sets one limit for both capture and parse (default 128 MB, 1 MB to 1 GB like Trivy), and the overflow errors name it. Refs #1281
scttbnsn
requested review from
ALARGECOMPANY and
biggest-littlest
as code owners
October 29, 2026 01:56
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 35 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Oct 29, 2026
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.
Refs #1281. The reporter's pre-update grype scans all failed with
Scanner worker exited with status 137on rc.8.Each scan runs in its own hardened worker container, and that worker's memory was hardcoded at 512 MiB. Grype goes over that on ordinary large images. I profiled rc.8 with grype on Colima (arm64, so the numbers are indicative):
Below the limit the worker is OOM-killed (
OOMKilled=true, exit 137, empty stderr), and drydock reported only the bare status. A real rc.8 scan ofnextcloud:30reproduced the reporter's exact message.Changes:
DD_SECURITY_WORKER_MEMORYsets the worker limit (512m,1g,1536mor bytes, at least6m), validated at startup. The default goes from 512 MiB to 1 GiB.DD_SECURITY_GRYPE_MAXOUTPUTBYTES, with the same bounds as Trivy's and a 128 MB default. A single limit now covers capture and parse. Before, it was 50 MB to capture and 20 MB to parse, and thenextcloud:30JSON is 59.6 MB, so a large image would have failed there once memory wasn't the problem.DD_SECURITY_AVAILABILITY_POLICY(defaultblock), notDD_SECURITY_BLOCK_SEVERITY. That's whyNONEdidn't let the reporter's updates through, andwarnis the workaround.