Skip to content

Commit

Permalink
Feat/add skip dirs option (#33)
Browse files Browse the repository at this point in the history
Fixes: #32
  • Loading branch information
anandg112 authored Mar 19, 2021
1 parent f5e208a commit c6431cf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Following inputs can be used as `step.with` keys:
| `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 |

| `skip-dirs` | String | | Comma separated list of directories where traversal is skipped |
[release]: https://github.com/aquasecurity/trivy-action/releases/latest
[release-img]: https://img.shields.io/github/release/aquasecurity/trivy-action.svg?logo=github
[marketplace]: https://github.com/marketplace/actions/aqua-security-trivy
Expand Down
5 changes: 5 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ inputs:
description: 'writes results to a file with the specified file name'
required: false
default: ''
skip-dirs:
description: 'comma separated list of directories where traversal is skipped'
required: false
default: ''
runs:
using: 'docker'
image: "Dockerfile"
Expand All @@ -55,3 +59,4 @@ runs:
- '-h ${{ inputs.output }}'
- '-i ${{ inputs.image-ref }}'
- '-j ${{ inputs.scan-ref }}'
- '-k ${{ inputs.skip-dirs }}'
8 changes: 7 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -e
while getopts "a:b:c:d:e:f:g:h:i:j:" o; do
while getopts "a:b:c:d:e:f:g:h:i:j:k:" o; do
case "${o}" in
a)
export scanType=${OPTARG}
Expand Down Expand Up @@ -32,6 +32,9 @@ while getopts "a:b:c:d:e:f:g:h:i:j:" o; do
j)
export scanRef=${OPTARG}
;;
k)
export skipDirs=${OPTARG}
;;
esac
done

Expand Down Expand Up @@ -64,6 +67,9 @@ fi
if [ $output ];then
ARGS="$ARGS --output $output"
fi
if [ $skipDirs ];then
ARGS="$ARGS --skip-dirs $skipDirs"
fi

echo "Running trivy with options: " --no-progress "${ARGS}" "${artifactRef}"
trivy ${scanType} --no-progress $ARGS ${artifactRef}

0 comments on commit c6431cf

Please sign in to comment.