-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trivy dependency scan test #85
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: build | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
trivy-repo-scan: | ||
name: Trivy Repo Scan & Upload to Security Tab | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
contents: write | ||
security-events: write | ||
|
||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run Trivy vulnerability scanner in repo mode | ||
uses: aquasecurity/[email protected] | ||
with: | ||
scan-type: 'fs' | ||
ignore-unfixed: true | ||
format: 'sarif' | ||
output: 'trivy-results.sarif' | ||
severity: 'CRITICAL' | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: 'trivy-results.sarif' | ||
|
||
reviewdog-pr-check: | ||
name: Trivy PR Check | ||
runs-on: ubuntu-latest | ||
needs: trivy-repo-scan | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get Changed Files | ||
id: changed-files | ||
run: | | ||
git fetch origin main | ||
git diff --name-only origin/main > changed-files.txt | ||
|
||
- name: Print Changed Files | ||
run: | | ||
echo "Changed files:" | ||
cat changed-files.txt | ||
|
||
- name: Run Trivy on Changed Files | ||
if: success() | ||
run: | | ||
mkdir trivy-results | ||
while read -r file; do | ||
echo "Scanning $file..." | ||
trivy fs --quiet --severity HIGH,CRITICAL --format json --output trivy-results/$(basename $file).json "$file" || true | ||
done < changed-files.txt | ||
|
||
- name: Run Reviewdog | ||
uses: reviewdog/action-trivy@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
trivy_command: fs | ||
trivy_target: ./trivy-results | ||
reporter: github-pr-review | ||
level: warning | ||
fail_on_error: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
bandit==1.7.5 | ||
bandit==1.7.5 | ||
flask==0.12.3 # Known vulnerabilities in Flask 0.12.x | ||
Check failure Code scanning / Trivy flask: Possible disclosure of permanent session cookie due to missing Vary: Cookie header High
Package: flask
Installed Version: 0.12.3 Vulnerability CVE-2023-30861 Severity: HIGH Fixed Version: 2.3.2, 2.2.5 Link: CVE-2023-30861 |
||
requests==2.18.4 # SSL issues in older Requests versions | ||
Check failure Code scanning / Trivy python-requests: Redirect from HTTPS to HTTP does not remove Authorization header High
Package: requests
Installed Version: 2.18.4 Vulnerability CVE-2018-18074 Severity: HIGH Fixed Version: 2.20.0 Link: CVE-2018-18074 Check warning Code scanning / Trivy python-requests: Unintended leak of Proxy-Authorization header Medium
Package: requests
Installed Version: 2.18.4 Vulnerability CVE-2023-32681 Severity: MEDIUM Fixed Version: 2.31.0 Link: CVE-2023-32681 Check warning Code scanning / Trivy requests: subsequent requests to the same host ignore cert verification Medium
Package: requests
Installed Version: 2.18.4 Vulnerability CVE-2024-35195 Severity: MEDIUM Fixed Version: 2.32.0 Link: CVE-2024-35195 |
Check failure
Code scanning / Trivy
python-flask: unexpected memory usage can lead to denial of service via crafted encoded JSON data High