Compare commits

...

6 Commits

Author SHA1 Message Date
Valentin Laurin
ac8de07fd1 Pass --cache-dir as global argument to Trivy (#51) 2021-05-27 09:03:06 -07:00
Anand Gautam
09b815c470 feat: add ignore-policy option to filter vulnerabilities (#48)
* feat: add ignore-policy option to filter vulnerabilities

* fix: format README
2021-05-26 13:12:03 -07:00
Simar
0ce0e69d98 Update README.md 2021-05-17 12:03:58 -07:00
rahul2393
dba83feec8 fix invalid rule exception for SARIF templates (#47) 2021-05-13 11:25:15 -07:00
Simar
c9017eb417 Revert "Use fixed Sarif template (#45)" (#46)
This reverts commit 4ef054abe6.
2021-05-13 09:50:48 -07:00
rahul2393
4ef054abe6 Use fixed Sarif template (#45) 2021-05-13 09:49:59 -07:00
4 changed files with 23 additions and 8 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
FROM aquasec/trivy:0.18.0
FROM aquasec/trivy:0.18.1
COPY entrypoint.sh /
RUN apk --no-cache add bash
RUN chmod +x /entrypoint.sh
+3 -2
View File
@@ -284,13 +284,14 @@ Following inputs can be used as `step.with` keys:
| `format` | String | `table` | Output format (`table`, `json`, `template`) |
| `template` | String | | Output template (`@/contrib/sarif.tpl`, `@/contrib/gitlab.tpl`, `@/contrib/junit.tpl`)|
| `output` | String | | Save results to a file |
| `exit-code` | String | `0` | Exit code when vulnerabilities were found |
| `exit-code` | String | `0` | Exit code when specified vulnerabilities are found |
| `ignore-unfixed` | Boolean | false | Ignore unpatched/unfixed vulnerabilities |
| `vuln-type` | String | `os,library` | Vulnerability types (os,library) |
| `severity` | String | `UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL` | Severities of vulnerabilities to be displayed |
| `severity` | String | `UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL` | Severities of vulnerabilities to scanned for and displayed |
| `skip-dirs` | String | | Comma separated list of directories where traversal is skipped |
| `cache-dir` | String | | Cache directory |
| `timeout` | String | `2m0s` | Scan timeout duration |
| `ignore-policy` | String | | Filter vulnerabilities with OPA rego language |
[release]: https://github.com/aquasecurity/trivy-action/releases/latest
[release-img]: https://img.shields.io/github/release/aquasecurity/trivy-action.svg?logo=github
+5
View File
@@ -57,6 +57,10 @@ inputs:
description: 'timeout (default 2m0s)'
required: false
default: ''
ignore-policy:
description: 'filter vulnerabilities with OPA rego language'
required: false
default: ''
runs:
using: 'docker'
image: "Dockerfile"
@@ -75,3 +79,4 @@ runs:
- '-l ${{ inputs.input }}'
- '-m ${{ inputs.cache-dir }}'
- '-n ${{ inputs.timeout }}'
- '-o ${{ inputs.ignore-policy }}'
+14 -5
View File
@@ -1,6 +1,6 @@
#!/bin/bash
set -e
while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:" o; do
while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:" o; do
case "${o}" in
a)
export scanType=${OPTARG}
@@ -44,6 +44,9 @@ while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:" o; do
n)
export timeout=${OPTARG}
;;
o)
export ignorePolicy=${OPTARG}
;;
esac
done
@@ -58,6 +61,11 @@ if [ $input ]; then
fi
ignoreUnfixed=$(echo $ignoreUnfixed | tr -d '\r')
GLOBAL_ARGS=""
if [ $cacheDir ];then
GLOBAL_ARGS="$GLOBAL_ARGS --cache-dir $cacheDir"
fi
ARGS=""
if [ $format ];then
ARGS="$ARGS --format $format"
@@ -86,12 +94,13 @@ if [ $skipDirs ];then
ARGS="$ARGS --skip-dirs $i"
done
fi
if [ $cacheDir ];then
ARGS="$ARGS --cache-dir $cacheDir"
fi
if [ $timeout ];then
ARGS="$ARGS --timeout $timeout"
fi
if [ $ignorePolicy ];then
ARGS="$ARGS --ignore-policy $ignorePolicy"
fi
echo "Running trivy with options: " --no-progress "${ARGS}" "${artifactRef}"
trivy ${scanType} --no-progress $ARGS ${artifactRef}
echo "Global options: " "${GLOBAL_ARGS}"
trivy $GLOBAL_ARGS ${scanType} --no-progress $ARGS ${artifactRef}