Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7a829a434 | ||
|
|
9c21d3ca2c | ||
|
|
8f4c7160b4 | ||
|
|
81cc8cd841 |
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM aquasec/trivy:0.21.0
|
FROM aquasec/trivy:0.23.0
|
||||||
COPY entrypoint.sh /
|
COPY entrypoint.sh /
|
||||||
RUN apk --no-cache add bash
|
RUN apk --no-cache add bash
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ jobs:
|
|||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'template'
|
format: 'sarif'
|
||||||
template: '@/contrib/sarif.tpl'
|
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
@@ -112,8 +111,7 @@ jobs:
|
|||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'template'
|
format: 'sarif'
|
||||||
template: '@/contrib/sarif.tpl'
|
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
@@ -149,8 +147,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
ignore-unfixed: true
|
ignore-unfixed: true
|
||||||
format: 'template'
|
format: 'sarif'
|
||||||
template: '@/contrib/sarif.tpl'
|
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
severity: 'CRITICAL'
|
severity: 'CRITICAL'
|
||||||
|
|
||||||
@@ -185,8 +182,7 @@ jobs:
|
|||||||
scan-type: 'rootfs'
|
scan-type: 'rootfs'
|
||||||
scan-ref: 'rootfs-example-binary'
|
scan-ref: 'rootfs-example-binary'
|
||||||
ignore-unfixed: true
|
ignore-unfixed: true
|
||||||
format: 'template'
|
format: 'sarif'
|
||||||
template: '@/contrib/sarif.tpl'
|
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
severity: 'CRITICAL'
|
severity: 'CRITICAL'
|
||||||
|
|
||||||
@@ -256,8 +252,7 @@ jobs:
|
|||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'template'
|
format: 'sarif'
|
||||||
template: '@/contrib/sarif.tpl'
|
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
env:
|
env:
|
||||||
TRIVY_USERNAME: Username
|
TRIVY_USERNAME: Username
|
||||||
@@ -293,8 +288,7 @@ jobs:
|
|||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
image-ref: 'aws_account_id.dkr.ecr.region.amazonaws.com/imageName:${{ github.sha }}'
|
image-ref: 'aws_account_id.dkr.ecr.region.amazonaws.com/imageName:${{ github.sha }}'
|
||||||
format: 'template'
|
format: 'sarif'
|
||||||
template: '@/contrib/sarif.tpl'
|
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: key_id
|
AWS_ACCESS_KEY_ID: key_id
|
||||||
@@ -330,8 +324,7 @@ jobs:
|
|||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'template'
|
format: 'sarif'
|
||||||
template: '@/contrib/sarif.tpl'
|
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
env:
|
env:
|
||||||
GOOGLE_APPLICATION_CREDENTIAL: /path/to/credential.json
|
GOOGLE_APPLICATION_CREDENTIAL: /path/to/credential.json
|
||||||
@@ -364,8 +357,7 @@ jobs:
|
|||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
|
||||||
format: 'template'
|
format: 'sarif'
|
||||||
template: '@/contrib/sarif.tpl'
|
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
env:
|
env:
|
||||||
TRIVY_USERNAME: Username
|
TRIVY_USERNAME: Username
|
||||||
@@ -389,8 +381,8 @@ Following inputs can be used as `step.with` keys:
|
|||||||
| `input` | String | | Tar reference, e.g. `alpine-latest.tar` |
|
| `input` | String | | Tar reference, e.g. `alpine-latest.tar` |
|
||||||
| `image-ref` | String | | Image reference, e.g. `alpine:3.10.2` |
|
| `image-ref` | String | | Image reference, e.g. `alpine:3.10.2` |
|
||||||
| `scan-ref` | String | `/github/workspace/` | Scan reference, e.g. `/github/workspace/` or `.`|
|
| `scan-ref` | String | `/github/workspace/` | Scan reference, e.g. `/github/workspace/` or `.`|
|
||||||
| `format` | String | `table` | Output format (`table`, `json`, `template`) |
|
| `format` | String | `table` | Output format (`table`, `json`, `sarif`) |
|
||||||
| `template` | String | | Output template (`@/contrib/sarif.tpl`, `@/contrib/gitlab.tpl`, `@/contrib/junit.tpl`)|
|
| `template` | String | | Output template (`@/contrib/gitlab.tpl`, `@/contrib/junit.tpl`)|
|
||||||
| `output` | String | | Save results to a file |
|
| `output` | String | | Save results to a file |
|
||||||
| `exit-code` | String | `0` | Exit code when specified vulnerabilities are found |
|
| `exit-code` | String | `0` | Exit code when specified vulnerabilities are found |
|
||||||
| `ignore-unfixed` | Boolean | false | Ignore unpatched/unfixed vulnerabilities |
|
| `ignore-unfixed` | Boolean | false | Ignore unpatched/unfixed vulnerabilities |
|
||||||
@@ -401,6 +393,7 @@ Following inputs can be used as `step.with` keys:
|
|||||||
| `cache-dir` | String | | Cache directory |
|
| `cache-dir` | String | | Cache directory |
|
||||||
| `timeout` | String | `2m0s` | Scan timeout duration |
|
| `timeout` | String | `2m0s` | Scan timeout duration |
|
||||||
| `ignore-policy` | String | | Filter vulnerabilities with OPA rego language |
|
| `ignore-policy` | String | | Filter vulnerabilities with OPA rego language |
|
||||||
|
| `list-all-pkgs` | String | | Output all packages regardless of vulnerability |
|
||||||
|
|
||||||
[release]: https://github.com/aquasecurity/trivy-action/releases/latest
|
[release]: https://github.com/aquasecurity/trivy-action/releases/latest
|
||||||
[release-img]: https://img.shields.io/github/release/aquasecurity/trivy-action.svg?logo=github
|
[release-img]: https://img.shields.io/github/release/aquasecurity/trivy-action.svg?logo=github
|
||||||
|
|||||||
@@ -69,6 +69,10 @@ inputs:
|
|||||||
description: 'hide progress output'
|
description: 'hide progress output'
|
||||||
required: false
|
required: false
|
||||||
default: 'true'
|
default: 'true'
|
||||||
|
list-all-pkgs:
|
||||||
|
description: 'output all packages regardless of vulnerability'
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: "Dockerfile"
|
image: "Dockerfile"
|
||||||
@@ -90,3 +94,4 @@ runs:
|
|||||||
- '-o ${{ inputs.ignore-policy }}'
|
- '-o ${{ inputs.ignore-policy }}'
|
||||||
- '-p ${{ inputs.hide-progress }}'
|
- '-p ${{ inputs.hide-progress }}'
|
||||||
- '-q ${{ inputs.skip-files }}'
|
- '-q ${{ inputs.skip-files }}'
|
||||||
|
- '-r ${{ inputs.list-all-pkgs }}'
|
||||||
|
|||||||
+11
-3
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:" o; do
|
while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:" o; do
|
||||||
case "${o}" in
|
case "${o}" in
|
||||||
a)
|
a)
|
||||||
export scanType=${OPTARG}
|
export scanType=${OPTARG}
|
||||||
@@ -53,6 +53,9 @@ while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:" o; do
|
|||||||
q)
|
q)
|
||||||
export skipFiles=${OPTARG}
|
export skipFiles=${OPTARG}
|
||||||
;;
|
;;
|
||||||
|
r)
|
||||||
|
export listAllPkgs=${OPTARG}
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -115,6 +118,11 @@ fi
|
|||||||
if [ "$hideProgress" == "true" ];then
|
if [ "$hideProgress" == "true" ];then
|
||||||
ARGS="$ARGS --no-progress"
|
ARGS="$ARGS --no-progress"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
listAllPkgs=$(echo $listAllPkgs | tr -d '\r')
|
||||||
|
if [ "$listAllPkgs" == "true" ];then
|
||||||
|
ARGS="$ARGS --list-all-pkgs"
|
||||||
|
fi
|
||||||
if [ "$skipFiles" ];then
|
if [ "$skipFiles" ];then
|
||||||
for i in $(echo $skipFiles | tr "," "\n")
|
for i in $(echo $skipFiles | tr "," "\n")
|
||||||
do
|
do
|
||||||
@@ -130,9 +138,9 @@ returnCode=$?
|
|||||||
# SARIF is special. We output all vulnerabilities,
|
# SARIF is special. We output all vulnerabilities,
|
||||||
# regardless of severity level specified in this report.
|
# regardless of severity level specified in this report.
|
||||||
# This is a feature, not a bug :)
|
# This is a feature, not a bug :)
|
||||||
if [[ ${template} == *"sarif"* ]]; then
|
if [[ "${format}" == "sarif" ]]; then
|
||||||
echo "Building SARIF report with options: ${SARIF_ARGS}" "${artifactRef}"
|
echo "Building SARIF report with options: ${SARIF_ARGS}" "${artifactRef}"
|
||||||
trivy --quiet ${scanType} --format template --template ${template} --output ${output} $SARIF_ARGS ${artifactRef}
|
trivy --quiet ${scanType} --format sarif --output ${output} $SARIF_ARGS ${artifactRef}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit $returnCode
|
exit $returnCode
|
||||||
|
|||||||
Reference in New Issue
Block a user