fix: update SBOM workflow to use syft config file and fix permissions #2444
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!2444
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2444/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub pull request.
Original GitHub pull request: #1976
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1976
Original created: 2025-11-22T23:31:20Z
Original updated: 2025-12-08T06:54:40Z
Original head: carverauto/serviceradar:chore/fix_sbom-syft
Original base: main
Original merged: 2025-11-22T23:35:40Z by @mfreeman451
User description
Summary
Fixes the failing SBOM (syft) workflow in CI/CD.
Changes
excludeparameter fromanchore/sbom-action@v0.syft.yamlconfig file for exclusions insteadcontents: readtocontents: writefor release asset uploadsIssue
The workflow was failing with:
Solution
The newer version of
anchore/sbom-actiondoesn't support theexcludeparameter directly. Instead, we need to use a syft config file. Also added write permissions for attaching SBOMs to releases.PR Type
Bug fix
Description
Replace unsupported
excludeparameter with.syft.yamlconfig fileUpgrade workflow permissions from read to write for release uploads
Add conditional release asset upload based on event type
Consolidate SBOM exclusion patterns into dedicated config file
Diagram Walkthrough
File Walkthrough
sbom-syft.yml
Migrate to syft config file and fix permissions.github/workflows/sbom-syft.yml
contents: readtocontents: writeto enable release asset uploads
.syft.yamlconfig file with exclusionpatterns for node_modules, vendor, target, .git, build, and release
directories
excludeparameter withconfig: .syft.yamlreference inanchore/sbom-action
upload-release-assetsparameter to only upload whentriggered by release event
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1976#issuecomment-3567145853
Original created: 2025-11-22T23:31:39Z
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
Excessive workflow permissions
Description: The workflow permission was elevated to
contents: write, granting broader repository writeaccess to the entire workflow which increases risk if any step or dependency is
compromised; scope this permission to only the job or step that needs it or use a
dedicated token to minimize impact.
sbom-syft.yml [9-9]
Referred Code
Shell heredoc safety
Description: The step writes a
.syft.yamlfrom shell without quoting EOF or setting safe shell options,which can allow unintended shell expansion or injection if future variables are
interpolated; use a quoted heredoc (e.g., <<'EOF') and
set -euo pipefailto harden.sbom-syft.yml [17-27]
Referred Code
Release asset upload risk
Description: The SBOM action may upload release assets when the event is
release, and combined withcontents: writethis could allow unintended asset modification if the workflow istriggered in forked contexts or reused; ensure
pull_requestfrom forks cannot reach thispath and restrict
permissionsat job level.sbom-syft.yml [35-36]
Referred Code
🎫 No ticket provided
Codebase context is not defined
Follow the guide to enable codebase context checks.
Generic: Meaningful Naming and Self-Documenting Code
Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting
Status: Passed
Generic: Secure Error Handling
Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.
Status: Passed
Generic: Secure Logging Practices
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.
Status: Passed
Generic: Comprehensive Audit Trails
Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.
Status:
Action Auditing: The workflow changes introduce permission escalation and conditional uploads without
explicit audit logging of key actions, which may or may not be handled elsewhere in the CI
logs.
Referred Code
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
Status:
Step Failures: The workflow steps (config creation, SBOM generation, artifact upload) do not include
explicit failure handling or retries, relying on default action behavior which may be
acceptable but is not explicit in the diff.
Referred Code
Generic: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities
Status:
Write Permission Scope: Elevating workflow permissions to contents: write broadens access without explicit scoping
or justification in-code, which may be necessary for release uploads but cannot be fully
validated from the diff alone.
Referred Code
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1976#issuecomment-3567146362
Original created: 2025-11-22T23:32:32Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Pin action to a specific version
Pin the
anchore/sbom-actionto a specific commit SHA instead of using thefloating tag
@v0to improve workflow security and reproducibility..github/workflows/sbom-syft.yml [29-36]
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly points out a security and reliability best practice. Pinning the GitHub Action version to a specific commit SHA prevents unexpected breaking changes and mitigates supply chain risks, which is a significant improvement for the workflow's stability.
Commit
.syft.yamlinstead of generating itInstead of dynamically generating the
.syft.yamlfile in the workflow, commit itdirectly to the repository. This separates configuration from CI logic,
improving maintainability and transparency.
Examples:
.github/workflows/sbom-syft.yml [17-28]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 7
__
Why: This is a strong suggestion for improving maintainability and adhering to best practices by version-controlling configuration instead of generating it dynamically in a CI script.
Prevent shell expansion in heredoc
In the
Create syft configstep, change the heredoc delimiter from<<EOFto<<'EOF'toprevent accidental shell expansion and make the script more robust.
.github/workflows/sbom-syft.yml [17-27]
Suggestion importance[1-10]: 6
__
Why: This is a valid suggestion that improves the robustness of the script by preventing unintentional shell expansion in the heredoc. While there is no immediate issue, this change makes the code safer against future modifications.