diff --git a/README.md b/README.md index 7d5e73a..99db07b 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,42 @@ jobs: sarif_file: 'trivy-results.sarif' ``` +### Using Trivy to scan your rootfs directories +It's also possible to scan your rootfs directories with Trivy's built-in rootfs scan. This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo. This helps you identify potential vulnerablites that might get introduced with each PR. + +If you have [GitHub code scanning](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning) available you can use Trivy as a scanning tool as follows: +```yaml +name: build +on: + push: + branches: + - master + pull_request: +jobs: + build: + name: Build + runs-on: ubuntu-18.04 + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Run Trivy vulnerability scanner with rootfs command + uses: aquasecurity/trivy-action@master + with: + scan-type: 'rootfs' + scan-ref: 'rootfs-example-binary' + ignore-unfixed: true + format: 'template' + template: '@/contrib/sarif.tpl' + output: 'trivy-results.sarif' + severity: 'CRITICAL' + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v1 + with: + sarif_file: 'trivy-results.sarif' +``` + ### Using Trivy to scan Infrastucture as Code It's also possible to scan your IaC repos with Trivy's built-in repo scan. This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo. This helps you identify potential vulnerablites that might get introduced with each PR. diff --git a/entrypoint.sh b/entrypoint.sh index d228136..a85c7d2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -55,7 +55,7 @@ done scanType=$(echo $scanType | tr -d '\r') export artifactRef="${imageRef}" -if [ "${scanType}" = "fs" ] || [ "${scanType}" = "config" ];then +if [ "${scanType}" = "fs" ] || [ "${scanType}" = "config" ] || [ "${scanType}" = "rootfs" ];then artifactRef=$(echo $scanRef | tr -d '\r') fi input=$(echo $input | tr -d '\r')