-
Notifications
You must be signed in to change notification settings - Fork 304
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
DAOS-623 ci: Add a workflow for Trivy scan #14623
Merged
Merged
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ce5510d
DAOS-623 ci: Add a workflow for Trivy scans
grom72 156e9a6
Minor changes after review
grom72 6c3d436
Limit the scope of workflow triggers
grom72 c9da1db
Assume backport to release 2.6
grom72 c676df4
Revert "Assume backport to release 2.6"
grom72 cf121a2
Revert "Revert "Assume backport to release 2.6""
grom72 b7277dd
Solution that assumes backport to release 2.6 branch
grom72 dd69b94
Simplify file extension generation.
grom72 a661156
Merge remote-tracking branch 'origin/master' into grom72/trivy
grom72 e02ca0f
A new version based on GHA
grom72 660b542
Add sarif format scan
grom72 5489392
Fix typo
grom72 666e3b9
Test for sarif w/ failures
grom72 bceb0ac
Backup Sarif file in the GitHub artifact store
grom72 0744af2
Revert "Backup Sarif file in the GitHub artifact store"
grom72 3036508
Revert "Test for sarif w/ failures"
grom72 857a1d4
Pin upload-sarif action by hash
grom72 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Trivy scan | ||
|
||
on: | ||
pull_request: | ||
branches: ["master", "release/**"] | ||
|
||
# Declare default permissions as nothing. | ||
permissions: {} | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Run Trivy vulnerability scanner in repo mode | ||
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 # 0.24.0 | ||
with: | ||
scan-type: 'fs' | ||
scan-ref: '.' | ||
trivy-config: 'utils/trivy/trivy.yaml' | ||
|
||
- name: Prepare the report to be uploaded to the GitHub artifact store | ||
run: | | ||
mkdir report | ||
cp trivy-report-daos.txt report | ||
cp utils/trivy/.trivyignore report/trivyignore.txt | ||
|
||
- name: Upload the report to the GitHub artifact store | ||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | ||
with: | ||
path: report/* | ||
name: trivy-report-daos | ||
|
||
- name: Adjust config file to show and validate scan results | ||
run: | | ||
sed -i 's/output: "trivy-report-daos.txt"//g' utils/trivy/trivy.yaml | ||
sed -i 's/format: template/format: table/g' utils/trivy/trivy.yaml | ||
sed -i 's/exit-code: 0/exit-code: 1/g' utils/trivy/trivy.yaml | ||
|
||
- name: Run Trivy vulnerability scanner in repo mode | ||
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 # 0.24.0 | ||
with: | ||
scan-type: 'fs' | ||
scan-ref: '.' | ||
trivy-config: 'utils/trivy/trivy.yaml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## Ignored hadoop related CVE | ||
## CVE-2023-52428,MEDIUM,,"Denial of Service in Connect2id Nimbus JOSE+JWT","com.nimbusds:nimbus-jose-jwt","9.8.1","9.37.2",https://avd.aquasec.com/nvd/cve-2023-52428 | ||
CVE-2023-52428 | ||
## CVE-2023-39410,HIGH,7.5,"apache-avro: Apache Avro Java SDK: Memory when deserializing untrusted data in Avro Java SDK","org.apache.avro:avro","1.7.7","1.11.3",https://avd.aquasec.com/nvd/cve-2023-39410 | ||
CVE-2023-39410 | ||
## CVE-2024-25710,HIGH,5.5,"commons-compress: Denial of service caused by an infinite loop for a corrupted DUMP file","org.apache.commons:commons-compress","1.21","1.26.0",https://avd.aquasec.com/nvd/cve-2024-25710 | ||
CVE-2024-25710 | ||
## CVE-2024-26308,HIGH,5.5,"commons-compress: OutOfMemoryError unpacking broken Pack200 file","org.apache.commons:commons-compress","1.21","1.26.0",https://avd.aquasec.com/nvd/cve-2024-26308 | ||
CVE-2024-26308 | ||
## CVE-2024-29131,MEDIUM,,"commons-configuration: StackOverflowError adding property in AbstractListDelimiterHandler.flattenIterator()","org.apache.commons:commons-configuration2","2.8.0","2.10.1",https://avd.aquasec.com/nvd/cve-2024-29131 | ||
CVE-2024-29131 | ||
## CVE-2024-29133,MEDIUM,,"commons-configuration: StackOverflowError calling ListDelimiterHandler.flatten(Object, int) with a cyclical object tree","org.apache.commons:commons-configuration2","2.8.0","2.10.1",https://avd.aquasec.com/nvd/cve-2024-29133 | ||
CVE-2024-29133 | ||
## CVE-2022-40150,HIGH,7.5,"jettison: memory exhaustion via user-supplied XML or JSON data","org.codehaus.jettison:jettison","1.1","1.5.2",https://avd.aquasec.com/nvd/cve-2022-40150 | ||
CVE-2022-40150 | ||
## CVE-2022-45685,HIGH,7.5,"jettison: stack overflow in JSONObject() allows attackers to cause a Denial of Service (DoS) via crafted JSON data","org.codehaus.jettison:jettison","1.1","1.5.2",https://avd.aquasec.com/nvd/cve-2022-45685 | ||
CVE-2022-45685 | ||
## CVE-2022-45693,HIGH,7.5,"jettison: If the value in map is the map's self, the new new JSONObject(map) cause StackOverflowError which may lead to dos","org.codehaus.jettison:jettison","1.1","1.5.2",https://avd.aquasec.com/nvd/cve-2022-45693 | ||
CVE-2022-45693 | ||
## CVE-2023-1436,HIGH,7.5,"jettison: Uncontrolled Recursion in JSONArray","org.codehaus.jettison:jettison","1.1","1.5.4",https://avd.aquasec.com/nvd/cve-2023-1436 | ||
CVE-2023-1436 | ||
## CVE-2022-40149,MEDIUM,7.5,"jettison: parser crash by stackoverflow","org.codehaus.jettison:jettison","1.1","1.5.1",https://avd.aquasec.com/nvd/cve-2022-40149 | ||
CVE-2022-40149 | ||
## CVE-2023-34455,HIGH,7.5,"snappy-java: Unchecked chunk length leads to DoS","org.xerial.snappy:snappy-java","1.1.8.2","1.1.10.1",https://avd.aquasec.com/nvd/cve-2023-34455 | ||
CVE-2023-34455 | ||
## CVE-2023-43642,HIGH,7.5,"snappy-java: Missing upper bound check on chunk length in snappy-java can lead to Denial of Service (DoS) impact","org.xerial.snappy:snappy-java","1.1.8.2","1.1.10.4",https://avd.aquasec.com/nvd/cve-2023-43642 | ||
CVE-2023-43642 | ||
## CVE-2023-34453,MEDIUM,7.5,"snappy-java: Integer overflow in shuffle leads to DoS","org.xerial.snappy:snappy-java","1.1.8.2","1.1.10.1",https://avd.aquasec.com/nvd/cve-2023-34453 | ||
CVE-2023-34453 | ||
## CVE-2023-34454,MEDIUM,7.5,"snappy-java: Integer overflow in compress leads to DoS","org.xerial.snappy:snappy-java","1.1.8.2","1.1.10.1",https://avd.aquasec.com/nvd/cve-2023-34454 | ||
CVE-2023-34454 | ||
## CVE-2024-25638,HIGH,,"dnsjava: Improper response validation allowing DNSSEC bypass","dnsjava:dnsjava","2.1.7","3.6.0",https://avd.aquasec.com/nvd/cve-2024-25638 | ||
CVE-2024-25638 | ||
|
||
## Ignore DNSJava-related issues | ||
## GHSA-crjg-w57m-rqqf,MEDIUM,,"DNSJava vulnerable to KeyTrap - Denial-of-Service Algorithmic Complexity Attacks","dnsjava:dnsjava","2.1.7","3.6.0",https://github.com/advisories/GHSA-crjg-w57m-rqqf | ||
GHSA-crjg-w57m-rqqf | ||
## GHSA-mmwx-rj87-vfgr,MEDIUM,,"DNSJava affected by KeyTrap - NSEC3 closest encloser proof can exhaust CPU resources","dnsjava:dnsjava","2.1.7","3.6.0",https://github.com/advisories/GHSA-mmwx-rj87-vfgr | ||
GHSA-mmwx-rj87-vfgr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{ range . }} | ||
Trivy Vulnerability Scan Results ({{- .Target -}}) | ||
VulnerabilityID,Severity,CVSS Score,Title,Library,Vulnerable Version,Fixed Version,Information URL,Triage Information | ||
{{ range .Vulnerabilities }} | ||
{{- .VulnerabilityID }}, | ||
{{- .Severity }}, | ||
{{- range $key, $value := .CVSS }} | ||
{{- if (eq $key "nvd") }} | ||
{{- .V3Score -}} | ||
{{- end }} | ||
{{- end }}, | ||
{{- quote .Title }}, | ||
{{- quote .PkgName }}, | ||
{{- quote .InstalledVersion }}, | ||
{{- quote .FixedVersion }}, | ||
{{- .PrimaryURL }} | ||
{{ else -}} | ||
No vulnerabilities found at this time. | ||
{{ end }} | ||
Trivy Dependency Scan Results ({{ .Target }}) | ||
ID,Name,Version,Notes | ||
{{ range .Packages -}} | ||
{{- quote .ID }}, | ||
{{- quote .Name }}, | ||
{{- quote .Version }} | ||
{{ else -}} | ||
No dependencies found at this time. | ||
{{ end }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
cache: | ||
backend: fs | ||
clear: false | ||
dir: | ||
redis: | ||
ca: "" | ||
cert: "" | ||
key: "" | ||
tls: false | ||
ttl: 0s | ||
config: trivy.yaml | ||
db: | ||
download-java-only: false | ||
download-only: false | ||
java-repository: ghcr.io/aquasecurity/trivy-java-db | ||
java-skip-update: false | ||
no-progress: false | ||
repository: ghcr.io/aquasecurity/trivy-db | ||
skip-update: false | ||
debug: false | ||
dependency-tree: true | ||
exit-code: 0 | ||
generate-default-config: false | ||
ignore-policy: "" | ||
ignorefile: ./utils/trivy/.trivyignore | ||
include-dev-deps: false | ||
insecure: false | ||
license: | ||
confidencelevel: "0.9" | ||
forbidden: | ||
- AGPL-1.0 | ||
- AGPL-3.0 | ||
- CC-BY-NC-1.0 | ||
- CC-BY-NC-2.0 | ||
- CC-BY-NC-2.5 | ||
- CC-BY-NC-3.0 | ||
- CC-BY-NC-4.0 | ||
- CC-BY-NC-ND-1.0 | ||
- CC-BY-NC-ND-2.0 | ||
- CC-BY-NC-ND-2.5 | ||
- CC-BY-NC-ND-3.0 | ||
- CC-BY-NC-ND-4.0 | ||
- CC-BY-NC-SA-1.0 | ||
- CC-BY-NC-SA-2.0 | ||
- CC-BY-NC-SA-2.5 | ||
- CC-BY-NC-SA-3.0 | ||
- CC-BY-NC-SA-4.0 | ||
- Commons-Clause | ||
- Facebook-2-Clause | ||
- Facebook-3-Clause | ||
- Facebook-Examples | ||
- WTFPL | ||
full: false | ||
ignored: [] | ||
notice: | ||
- AFL-1.1 | ||
- AFL-1.2 | ||
- AFL-2.0 | ||
- AFL-2.1 | ||
- AFL-3.0 | ||
- Apache-1.0 | ||
- Apache-1.1 | ||
- Apache-2.0 | ||
- Artistic-1.0-cl8 | ||
- Artistic-1.0-Perl | ||
- Artistic-1.0 | ||
- Artistic-2.0 | ||
- BSL-1.0 | ||
- BSD-2-Clause-FreeBSD | ||
- BSD-2-Clause-NetBSD | ||
- BSD-2-Clause | ||
- BSD-3-Clause-Attribution | ||
- BSD-3-Clause-Clear | ||
- BSD-3-Clause-LBNL | ||
- BSD-3-Clause | ||
- BSD-4-Clause | ||
- BSD-4-Clause-UC | ||
- BSD-Protection | ||
- CC-BY-1.0 | ||
- CC-BY-2.0 | ||
- CC-BY-2.5 | ||
- CC-BY-3.0 | ||
- CC-BY-4.0 | ||
- FTL | ||
- ISC | ||
- ImageMagick | ||
- Libpng | ||
- Lil-1.0 | ||
- Linux-OpenIB | ||
- LPL-1.02 | ||
- LPL-1.0 | ||
- MS-PL | ||
- MIT | ||
- NCSA | ||
- OpenSSL | ||
- PHP-3.01 | ||
- PHP-3.0 | ||
- PIL | ||
- Python-2.0 | ||
- Python-2.0-complete | ||
- PostgreSQL | ||
- SGI-B-1.0 | ||
- SGI-B-1.1 | ||
- SGI-B-2.0 | ||
- Unicode-DFS-2015 | ||
- Unicode-DFS-2016 | ||
- Unicode-TOU | ||
- UPL-1.0 | ||
- W3C-19980720 | ||
- W3C-20150513 | ||
- W3C | ||
- X11 | ||
- Xnet | ||
- Zend-2.0 | ||
- zlib-acknowledgement | ||
- Zlib | ||
- ZPL-1.1 | ||
- ZPL-2.0 | ||
- ZPL-2.1 | ||
permissive: [] | ||
reciprocal: | ||
- APSL-1.0 | ||
- APSL-1.1 | ||
- APSL-1.2 | ||
- APSL-2.0 | ||
- CDDL-1.0 | ||
- CDDL-1.1 | ||
- CPL-1.0 | ||
- EPL-1.0 | ||
- EPL-2.0 | ||
- FreeImage | ||
- IPL-1.0 | ||
- MPL-1.0 | ||
- MPL-1.1 | ||
- MPL-2.0 | ||
- Ruby | ||
restricted: | ||
- BCL | ||
- CC-BY-ND-1.0 | ||
- CC-BY-ND-2.0 | ||
- CC-BY-ND-2.5 | ||
- CC-BY-ND-3.0 | ||
- CC-BY-ND-4.0 | ||
- CC-BY-SA-1.0 | ||
- CC-BY-SA-2.0 | ||
- CC-BY-SA-2.5 | ||
- CC-BY-SA-3.0 | ||
- CC-BY-SA-4.0 | ||
- GPL-1.0 | ||
- GPL-2.0 | ||
- GPL-2.0-with-autoconf-exception | ||
- GPL-2.0-with-bison-exception | ||
- GPL-2.0-with-classpath-exception | ||
- GPL-2.0-with-font-exception | ||
- GPL-2.0-with-GCC-exception | ||
- GPL-3.0 | ||
- GPL-3.0-with-autoconf-exception | ||
- GPL-3.0-with-GCC-exception | ||
- LGPL-2.0 | ||
- LGPL-2.1 | ||
- LGPL-3.0 | ||
- NPL-1.0 | ||
- NPL-1.1 | ||
- OSL-1.0 | ||
- OSL-1.1 | ||
- OSL-2.0 | ||
- OSL-2.1 | ||
- OSL-3.0 | ||
- QPL-1.0 | ||
- Sleepycat | ||
unencumbered: | ||
- CC0-1.0 | ||
- Unlicense | ||
- 0BSD | ||
list-all-pkgs: false | ||
misconfiguration: | ||
cloudformation: | ||
params: [] | ||
helm: | ||
set: [] | ||
set-file: [] | ||
set-string: [] | ||
values: [] | ||
include-non-failures: false | ||
check-bundle-repository: ghcr.io/aquasecurity/trivy-policies:0 | ||
# scanners: | ||
# - azure-arm | ||
# - cloudformation | ||
# - dockerfile | ||
# - helm | ||
# - kubernetes | ||
# - terraform | ||
# - terraformplan | ||
terraform: | ||
exclude-downloaded-modules: false | ||
vars: [] | ||
module: | ||
dir: | ||
enable-modules: [] | ||
output: "trivy-report-daos.txt" | ||
format: template | ||
template: '@./utils/trivy/csv.tpl' | ||
output-plugin-arg: "" | ||
quiet: false | ||
registry: | ||
password: [] | ||
token: "" | ||
username: [] | ||
rego: | ||
data: [] | ||
namespaces: [] | ||
policy: [] | ||
skip-policy-update: false | ||
trace: false | ||
report: all | ||
scan: | ||
compliance: "" | ||
file-patterns: [] | ||
offline: false | ||
parallel: 1 | ||
rekor-url: https://rekor.sigstore.dev | ||
sbom-sources: [] | ||
scanners: | ||
- vuln | ||
- secret | ||
# ignore all hadoop dependencies | ||
skip-dirs: | ||
./src/client/java/hadoop-daos | ||
skip-files: [] | ||
show-suppressed: true | ||
secret: | ||
config: trivy-secret.yaml | ||
server: | ||
addr: "" | ||
custom-headers: [] | ||
token: "" | ||
token-header: Trivy-Token | ||
severity: | ||
- UNKNOWN | ||
- MEDIUM | ||
- HIGH | ||
- CRITICAL | ||
timeout: 5m0s | ||
version: false | ||
vulnerability: | ||
ignore-status: [] | ||
ignore-unfixed: false | ||
type: | ||
- os | ||
- library |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a lot of ignored CVEs. Are we allowed to ignore this many? Some of them are
HIGH
even.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Is there a reason we don't take advantage of the whole Code Scanning workflow in GitHub with this action?
https://github.com/aquasecurity/trivy-action#using-trivy-with-github-code-scanning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow supports two things:
Sarif scan added. Results of the run w/ expected failures are here (see first two issues):
https://github.com/daos-stack/daos/security/code-scanning?query=pr%3A14623+is%3Aclosed