Add workflow to perform vulns scan for pull requests#916
Add workflow to perform vulns scan for pull requests#916
Conversation
|
Caution Review failedFailed to post review comments WalkthroughAdds a new GitHub Actions workflow that generates a CycloneDX SBOM from Poetry-managed dependencies and scans it with Trivy (failing on HIGH/CRITICAL). Also bumps minimum Python to 3.9 across CI, updates pyproject and docs, and records these changes in CHANGELOG. Changes
Sequence Diagram(s)sequenceDiagram
participant GH as "GitHub Actions Runner"
participant Repo as "Repository (checkout)"
participant Py as "Setup Python 3.9 & Poetry"
participant Poetry as "Poetry (install deps)"
participant Cyclone as "cyclonedx-bom (cyclonedx-py)"
participant Trivy as "Trivy Scanner"
participant Result as "Job Result"
Note over GH: workflow triggered (push/PR/dispatch)
GH->>Repo: checkout code
Repo->>Py: setup Python 3.9, ensure Poetry on PATH
Py->>Poetry: install project dependencies (poetry install)
Poetry->>Cyclone: run `cyclonedx-py poetry` -> generate `sbom.json`
Cyclone->>Trivy: provide `sbom.json` for scanning
Trivy->>Result: return findings (fail on HIGH/CRITICAL)
Result->>GH: mark workflow success/failure
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
75b9689 to
f374693
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/vulnerability_scan.yml:
- Line 22: The workflow pins the cyclonedx-bom version via CYCLONEDX_BOM_VERSION
set to 7.2.0; update that variable to 7.2.2 to pick up the latest patch releases
(7.2.1/7.2.2), commit the change in the workflow file, then run CI to ensure the
updated bom generation step (referenced by CYCLONEDX_BOM_VERSION) works with the
new patch version.
- Around line 34-37: The Checkout step using actions/checkout@v4 contains a
no-op ref override that checks inputs.git_ref (which is not declared) so the
expression is always false; either remove the entire with: ref: ... block from
the "Checkout code" step to let actions/checkout use its default github.ref, or
declare a workflow_dispatch input named git_ref and then keep the conditional
expression — update the workflow_dispatch inputs to include git_ref (and its
default/description) so the inputs.git_ref reference is valid when used by the
actions/checkout@v4 step.
|
|
||
| [tool.poetry.group.dev.dependencies] | ||
| # urllib3 >= 2.6.3 fixes CVE-2025-66418, CVE-2025-66471, CVE-2026-21441 | ||
| urllib3 = ">=2.6.3" |
There was a problem hiding this comment.
Since urllib3 is a transitive dependency, did we try upgrading the root dependency to see if poetry.lock gets the urllib3 = ">=2.6.3"? Or was it giving more than expected number errors and you had to pin it in pyproject.toml?
|
Can we deprecate Python 3.8 support in a separate PR? Otherwise it'll be a bit buried and hard to find later. |
|
Close as we’ve decided not to run Trivy scans on every PR. |
High Level Overview of Change
vulnerability_scan.yml) that scans project dependencies for security vulnerabilities during CI. The workflow:Context of Change
The release pipeline (
release.yml) already includes vulnerability scanning, but it only runs during the release process. This change shifts security scanning left by running it on every PR and push tomain, allowing developers to catch and fix vulnerabilities earlier in the development cycle. This also catches newly disclosed vulnerabilities in existing dependencies.The workflow includes cost optimizations:
Type of Change
Did you update CHANGELOG.md?
Test Plan