Skip to content

fix(sbom): make sc sbom generate fail loudly on syft errors#285

Closed
Cre-eD wants to merge 2 commits into
mainfrom
fix/sbom-cli-required
Closed

fix(sbom): make sc sbom generate fail loudly on syft errors#285
Cre-eD wants to merge 2 commits into
mainfrom
fix/sbom-cli-required

Conversation

@Cre-eD

@Cre-eD Cre-eD commented May 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • sc sbom generate built a SecurityConfig with SBOM.Required=false, telling the executor to fail-open on syft errors. The executor returned (nil, nil) after printing Warning: SBOM generation failed, continuing, but the CLI wrapper turned that into Error: no SBOM generated and exit 1 — fail-open semantics with a fail-closed exit code.
  • For a user-invoked sc sbom generate, the right behavior is fail-loud. Setting SBOM.Required=true lets the executor propagate the underlying syft error (signal: killed for OOM, registry timeouts, etc.), which the wrapper already maps to failed to generate SBOM: <reason>.

Why this matters

Surfaced by a PAY-SPACE pay_space_wallet production deploy where syft was OOM-killed on a large image:

Warning: SBOM generation failed, continuing: syft command failed: signal: killed (stderr: )
Error: no SBOM generated
Error: no SBOM generated
error: update failed

Pulumi (running sc sbom generate as a step) saw exit 1, aborted the stack update, and the production deploy hard-failed. The misleading signal: killed (stderr: ) was the real diagnostic — this PR makes sure it reaches the user instead of being shadowed by the bogus wrapper error.

Test plan

  • go build ./pkg/cmd/cmd_sbom/... ./pkg/security/... — clean
  • CI green
  • On next preview, manually invoke sc sbom generate against a known-large image and confirm the real syft stderr (or OOM signal) is surfaced verbatim instead of no SBOM generated

The standalone CLI built a SecurityConfig with SBOM.Required=false, which
told the executor to fail-open: on syft errors it printed
"Warning: SBOM generation failed, continuing" and returned (nil, nil).
The CLI wrapper then turned that nil-nil into "Error: no SBOM generated"
and exited 1 — fail-open semantics with a fail-closed exit code.

For a user-invoked `sc sbom generate`, the right behavior is fail-loud:
surface the real syft error (signal: killed for OOM, registry timeouts,
etc.) so the caller knows why. Setting Required=true makes the executor
return the underlying error directly, which the wrapper already maps to
"failed to generate SBOM: <reason>".

Surfaced by a PAY-SPACE pay_space_wallet production deploy where syft
was OOM-killed on a large image; Pulumi saw "no SBOM generated" exit 1
and aborted the stack update.

Signed-off-by: Dmitrii Creed <creeed22@gmail.com>
@Cre-eD
Cre-eD requested a review from smecsia as a code owner May 21, 2026 12:18
@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown

Semgrep Scan Results

Repository: api | Commit: 6be8ff4

Check Status Details
⚠️ Semgrep Warning 10 warning(s), 10 total

Scanned at 2026-05-22 08:31 UTC

@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown

Security Scan Results

Repository: api | Commit: 6be8ff4

Check Status Details
✅ Secret Scan Pass No secrets detected
❌ Dependencies Failed Check workflow logs

Scanned at 2026-05-22 08:31 UTC

@Cre-eD Cre-eD closed this May 24, 2026
@Cre-eD
Cre-eD deleted the fix/sbom-cli-required branch May 24, 2026 13: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.

2 participants