test: add trivy action to scan CVE
Reason for Change:
test: add trivy action to scan CVE
Requirements
- [ ] added unit tests and e2e tests (if applicable).
Issue Fixed:
Notes for Reviewers:
Title
(Describe updated until commit https://github.com/kaito-project/kaito/commit/2c4d66c113b00ce32d69fc295a5f05fa7fc69088)
Add Trivy Action for Vulnerability Scanning
Description
-
Added Trivy action for vulnerability scanning
-
Configured to run on push and pull request events
-
Scans Docker images for OS and library vulnerabilities
Changes walkthrough π
| Relevant files | |||
|---|---|---|---|
| Enhancement |
|
Need help?
Type /help how to ...in the comments thread for any questions about PR-Agent usage.Check out the documentation for more information.
PR Reviewer Guide π
(Review updated until commit https://github.com/kaito-project/kaito/commit/2c4d66c113b00ce32d69fc295a5f05fa7fc69088)
Here are some key observations to aid the review process:
| β±οΈΒ Estimated effort to review: 2 π΅π΅βͺβͺβͺ |
| π§ͺΒ No relevant tests |
| πΒ No security concerns identified |
β‘Β Recommended focus areas for reviewBranch Name
|
PR Code Suggestions β¨
Latest suggestions up to 2c4d66c
Explore these optional code suggestions:
| Category | SuggestionΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Impact |
| General |
Pin trivy-action versionPin the version of the trivy-action to a stable release instead of using .github/workflows/trivy.yml [31]
Suggestion importance[1-10]: 8__ Why: Pinning the version of the trivy-action to a stable release ensures consistency and avoids unexpected behavior due to changes in the master branch. | Medium |
Update Trivy DB URLUpdate the Trivy DB repository URL to the latest stable version. .github/workflows/trivy.yml [33]
Suggestion importance[1-10]: 7__ Why: Updating the Trivy DB repository URL to the latest stable version ensures that the vulnerability database is current, improving the effectiveness of the vulnerability scan. | Medium | |
Filter lower severity vulnerabilitiesConsider filtering out lower severity vulnerabilities if they are not critical for .github/workflows/trivy.yml [40]
Suggestion importance[1-10]: 6__ Why: Filtering out lower severity vulnerabilities can help focus on critical and high-severity issues, making the scan results more actionable and reducing noise. | Low |
Previous suggestions
Suggestions up to commit 1be056b
| Category | SuggestionΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Impact |
| General |
Pin trivy-action versionPin the version of the trivy-action to a stable release instead of using .github/workflows/trivy.yml [31]
Suggestion importance[1-10]: 8__ Why: Pinning the version of the trivy-action to a stable release ensures consistency and prevents unexpected changes due to updates in the master branch. | Medium |
Update Trivy DB URLUpdate the Trivy database repository URL to the latest stable version. .github/workflows/trivy.yml [33]
Suggestion importance[1-10]: 7__ Why: Updating the Trivy database repository URL to the latest stable version ensures that the vulnerability scanner uses the most recent data, improving the accuracy of the scans. | Medium | |
Filter low severity vulnerabilitiesConsider filtering out lower severity vulnerabilities if they are not critical for .github/workflows/trivy.yml [40]
Suggestion importance[1-10]: 6__ Why: Filtering out lower severity vulnerabilities can help focus on the most critical issues, making the scan results more actionable. However, this depends on the project's risk tolerance. | Low |
Suggestions up to commit 8a6daf3
| Category | SuggestionΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Impact |
| General |
Pin trivy-action versionPin the version of the trivy-action to a stable release instead of using .github/workflows/trivy.yml [31]
Suggestion importance[1-10]: 8__ Why: Pinning the version of the trivy-action to a stable release ensures consistency and prevents unexpected behavior due to changes in the master branch. | Medium |
Update Trivy DB URLUpdate the Trivy database repository URL to the latest stable version. .github/workflows/trivy.yml [33]
Suggestion importance[1-10]: 7__ Why: Updating the Trivy database repository URL to the latest stable version ensures that the vulnerability scanner uses the most recent data, improving the accuracy of the scans. | Medium | |
Filter critical and high severityConsider reducing the severity levels to focus on critical and high vulnerabilities. .github/workflows/trivy.yml [40]
Suggestion importance[1-10]: 6__ Why: Reducing the severity levels to focus on critical and high vulnerabilities helps prioritize fixing the most severe issues, although this might miss some lower-severity vulnerabilities. | Low |
Suggestions up to commit 8a6daf3
| Category | SuggestionΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Impact |
| Security |
Pin trivy-action versionPin the version of the trivy-action to a specific release instead of using .github/workflows/trivy.yml [31]
Suggestion importance[1-10]: 8__ Why: Pinning the version of the trivy-action to a specific release improves security and ensures consistency across builds. | Medium |
| General |
Reduce severity levelsConsider reducing the severity levels to focus on CRITICAL and HIGH vulnerabilities. .github/workflows/trivy.yml [40]
Suggestion importance[1-10]: 5__ Why: Reducing the severity levels to CRITICAL and HIGH can help focus on the most impactful vulnerabilities, but this might miss some important MEDIUM or LOW issues. | Low |
Suggestions up to commit a5160e8
| Category | SuggestionΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Impact |
| General |
Pin trivy-action versionPin the version of the trivy-action to a stable release instead of using .github/workflows/trivy.yml [30]
Suggestion importance[1-10]: 8__ Why: Pinning the version of the trivy-action ensures consistency and prevents unexpected changes due to updates in the master branch. | Medium |
Filter lower severity vulnerabilitiesConsider filtering out lower severity vulnerabilities unless necessary. .github/workflows/trivy.yml [39]
Suggestion importance[1-10]: 6__ Why: Filtering out lower severity vulnerabilities can reduce noise and focus on critical issues. However, the decision to do so depends on the project's security policy. | Low | |
Correct Trivy DB URLEnsure the Trivy DB repository URL is correct and accessible. .github/workflows/trivy.yml [32]
Suggestion importance[1-10]: 5__ Why: The suggested change removes the version tag from the Trivy DB repository URL, which might not be necessary if the version is intended to be fixed. However, it's worth verifying the accessibility and correctness of the URL. | Low |
@Fei-Guo just let me know if this PR could be merged, and then I will add similar trivy action steps for other image build, thanks.
@Fei-Guo just let me know if this PR could be merged, and then I will add similar trivy action steps for other image build, thanks.
@Fei-Guo can you add me into this project member? This PR could not run tests in my forked branch, only project member can run those tests, I will prepare another PR later. thanks.
this trivy action error is expected, it needs this PR merge first: https://github.com/kaito-project/kaito/pull/1022
manager (gobinary)
==================
Total: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 1, HIGH: 0, CRITICAL: 0)
ββββββββββββββββββββ¬βββββββββββββββββ¬βββββββββββ¬βββββββββ¬ββββββββββββββββββββ¬ββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Library β Vulnerability β Severity β Status β Installed Version β Fixed Version β Title β
ββββββββββββββββββββΌβββββββββββββββββΌβββββββββββΌβββββββββΌββββββββββββββββββββΌββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β golang.org/x/net β CVE-2025-22872 β MEDIUM β fixed β v0.36.0 β 0.38.0 β golang.org/x/net/html: Incorrect Neutralization of Input β
β β β β β β β During Web Page Generation in x/net in... β
β β β β β β β https://avd.aquasec.com/nvd/cve-2025-22872 β
ββββββββββββββββββββ΄βββββββββββββββββ΄βββββββββββ΄βββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
One question: do we have to do trivvy scan for every PR? can we make it an action item and triggered upon release?
One question: do we have to do trivvy scan for every PR? can we make it an action item and triggered upon release?
@Fei-Guo yes, that's best for finding the CVE and fix CVE as early as possible. if you find CVE after image release, you need to fix it and publish new patch version. pls approve this PR, I will add trivy actions for other images in another PR. thanks.