Skip to content
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

Allow for replacing FROM image in locked down environments #335

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
@@ -1,4 +1,4 @@
FROM ghcr.io/aquasecurity/trivy:0.50.1
FROM placeholder
COPY entrypoint.sh /
RUN apk --no-cache add bash curl npm
RUN chmod +x /entrypoint.sh
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -591,6 +591,7 @@ Following inputs can be used as `step.with` keys:
| `github-pat` | String | | Authentication token to enable sending SBOM scan results to GitHub Dependency Graph. Can be either a GitHub Personal Access Token (PAT) or GITHUB_TOKEN |
| `limit-severities-for-sarif` | Boolean | false | By default *SARIF* format enforces output of all vulnerabilities regardless of configured severities. To override this behavior set this parameter to **true** |
| `docker-host` | String | | By default it is set to `unix://var/run/docker.sock`, but can be updated to help with containerized infrastructure values |
| `base-image` | String | `ghcr.io/aquasecurity/trivy:0.50.1` | Change the path, hostname or image name of the image running the scans. |

### Environment variables
You can use [Trivy environment variables][trivy-env] to set the necessary options (including flags that are not supported by [Inputs](#inputs), such as `--secret-config`).
Expand Down
7 changes: 7 additions & 0 deletions action.yaml
Expand Up @@ -97,10 +97,17 @@ inputs:
docker-host:
description: 'unix domain socket path to use for docker scanning, ex. unix:///var/run/docker.sock'
required: false
base-image:
description: 'alternative base-image URL'
default: 'ghcr.io/aquasecurity/trivy:0.50.1'
required: false

runs:
using: 'docker'
image: "Dockerfile"
pre-entrypoint: 'setup.sh'
env:
base_image: '${{ inputs.base-image }}'
args:
- '-a ${{ inputs.scan-type }}'
- '-b ${{ inputs.format }}'
Expand Down
10 changes: 10 additions & 0 deletions setup.sh
@@ -0,0 +1,10 @@
#!/bin/env bash
set -o nounset
set -o errexit
set -o errtrace
set -o pipefail
IFS=$'\n\t'

[ ! -z "${base_image}" ] && true || false

sed 's/placeholder/'"${base_image}"'/' Dockerfile