Add SBOM compliance checker script (SPDX/CycloneDX, scores 1-10)#91
Add SBOM compliance checker script (SPDX/CycloneDX, scores 1-10)#91jasinner wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughA new CLI tool ChangesSBOM Validation Tool
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@sbom/validate_sbom.py`:
- Around line 942-947: The docstring claims exit code 3 for "File could not be
parsed" but main() only returns 0/1/2; to fix, change main() (the return logic
around final_score) to explicitly return 3 when a parse failure is detected:
check the parse failure indicator (prefer a dedicated boolean set when parsing
fails, or scan the findings list for a CRITICAL "File could not be parsed"
finding) before evaluating final_score, and return 3 if present; otherwise keep
the existing final_score -> 0/1/2 mapping. Alternatively, if you prefer not to
add a parse-specific exit, update the module docstring to remove the exit code 3
description so it matches main() behavior.
- Around line 807-809: The code currently mutates the module-level
_SEVERITY_COLORS dict when use_color is False, breaking re-use and tests;
instead, create a local copy (e.g., colors = dict(_SEVERITY_COLORS)), modify
that local copy when use_color is False (set values to ""), and update all calls
to the helper _c() within the function to use this local colors mapping (pass it
as an extra parameter or capture it in a closure) so the global _SEVERITY_COLORS
remains unchanged.
- Around line 924-925: The JSON counts are being taken from the filtered result
(result.counts() and result.unique_counts()) but final_score was computed before
filtering; capture the pre-filter counts and unique counts into local variables
(e.g., counts_before and unique_counts_before) before the filtering that happens
in the block around result.findings, then use those captured variables in the
JSON payload instead of calling result.counts()/result.unique_counts() so the
counts align with final_score; update any references to counts in the output
generation to use those pre-filter variables and leave the filtering of
result.findings as-is.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: e2d3a70c-bbfb-4813-af6b-adf7c2da6631
📒 Files selected for processing (1)
sbom/validate_sbom.py
python3 sbom/validate_sbom.py <sbom-file.json[.gz]>