Skip to content

fix: add /tmp emptyDir volume to SBOM scanner sidecar#811

Merged
slashben merged 1 commit intomainfrom
fix/sbom-scanner-sidecar-tmp-volume
Apr 9, 2026
Merged

fix: add /tmp emptyDir volume to SBOM scanner sidecar#811
slashben merged 1 commit intomainfrom
fix/sbom-scanner-sidecar-tmp-volume

Conversation

@slashben
Copy link
Copy Markdown
Contributor

@slashben slashben commented Apr 5, 2026

Summary

  • Adds an emptyDir volume (sbom-scanner-tmp) mounted at /tmp to the node-agent SBOM scanner sidecar
  • Syft's Java cataloger needs writable temp space to process JAR archives (Go's archive/zip requires io.ReaderAt, which uses temp files for random access)
  • Without /tmp, Java packages are silently dropped from SBOMs (e.g., nginx SBOM missing libintl at /usr/share/java/libintl-0.21.jar — 142 packages instead of 143)
  • readOnlyRootFilesystem: true stays in place — the emptyDir provides writable temp space without weakening security
  • The kubevuln sidecar already has /tmp mounted correctly; only the node-agent sidecar was missing it

Test plan

  • helm unittest charts/kubescape-operator/ — all 12 tests, 656 snapshots pass
  • helm template with nodeAgent.sbomScanner.enabled=true confirms /tmp volumeMount and sbom-scanner-tmp volume render correctly
  • Deploy to test cluster and verify Java packages appear in SBOM output

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated SBOM scanner component configuration to provide dedicated temporary storage support.

The SBOM scanner sidecar runs with readOnlyRootFilesystem: true but
Syft's Java cataloger needs writable temp space to process JAR archives
(Go's archive/zip requires io.ReaderAt for random access via temp files).
Without /tmp, Java packages are silently dropped from SBOMs, causing
incomplete vulnerability scans.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ben <ben@armosec.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 5, 2026

📝 Walkthrough

Walkthrough

The Helm chart values configuration for the nodeAgent.sbomScanner sidecar container has been updated to include a writable temporary directory mount point. A new volume mount referencing /tmp and a corresponding empty directory volume have been added to support the SBOM scanner's operational needs.

Changes

Cohort / File(s) Summary
Helm Chart Configuration
charts/kubescape-operator/values.yaml
Added volumeMount entry mountPath: /tmp named sbom-scanner-tmp and corresponding emptyDir volume definition to nodeAgent.sbomScanner sidecar container configuration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • matthyx

Poem

🐰 A hop and a bound, a tmp dir so fine,
For SBOM scanning to shine and align,
emptyDir magic, no storage to keep,
The scanner hops safe through data so deep!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: adding a /tmp emptyDir volume to the SBOM scanner sidecar. It is concise, clear, and directly reflects the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sbom-scanner-sidecar-tmp-volume

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
charts/kubescape-operator/values.yaml (1)

790-791: Consider bounding /tmp growth for safer node-level behavior.

emptyDir: {} is valid, but adding a sizeLimit can reduce eviction risk during large image/JAR processing spikes.

Suggested values tweak
     volumes:
       - name: sbom-comm
         emptyDir:
           medium: Memory
           sizeLimit: 10Mi
       - name: sbom-scanner-tmp
-        emptyDir: {}
+        emptyDir:
+          sizeLimit: 2Gi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/kubescape-operator/values.yaml` around lines 790 - 791, The emptyDir
volume named "sbom-scanner-tmp" currently uses an unbounded emptyDir (emptyDir:
{}); change it to a bounded emptyDir by adding a sizeLimit (and optionally
medium if you want memory-backed tmpfs) so the sbom-scanner-tmp volume cannot
grow unbounded and cause node evictions—update the sbom-scanner-tmp emptyDir
stanza to include a sensible sizeLimit (for example "1Gi" or another
cluster-appropriate value).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@charts/kubescape-operator/values.yaml`:
- Around line 790-791: The emptyDir volume named "sbom-scanner-tmp" currently
uses an unbounded emptyDir (emptyDir: {}); change it to a bounded emptyDir by
adding a sizeLimit (and optionally medium if you want memory-backed tmpfs) so
the sbom-scanner-tmp volume cannot grow unbounded and cause node
evictions—update the sbom-scanner-tmp emptyDir stanza to include a sensible
sizeLimit (for example "1Gi" or another cluster-appropriate value).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7e6ffdd5-5bbf-430d-8d07-d85185d53ae0

📥 Commits

Reviewing files that changed from the base of the PR and between cdac526 and 6008b5c.

📒 Files selected for processing (1)
  • charts/kubescape-operator/values.yaml

Copy link
Copy Markdown
Contributor

@matthyx matthyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slashben good catch ! Validated on my side, looking good 👍

@slashben slashben merged commit 6cf5910 into main Apr 9, 2026
9 checks passed
@slashben slashben deleted the fix/sbom-scanner-sidecar-tmp-volume branch April 9, 2026 06:26
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.

2 participants