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

🪞 Optionally use ECR for Trivy's database #282

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions terraform-static-analysis/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ inputs:
description: "The name of the main branch e.g. 'main', defaults to 'main'"
required: false
default: "main"
use_trivy_ecr_database:
description: "Download the Trivy databases from ECR"
required: false
default: "false"

runs:
using: "docker"
Expand Down
8 changes: 8 additions & 0 deletions terraform-static-analysis/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ echo "INPUT_TRIVY_SEVERITY: $INPUT_TRIVY_SEVERITY"
echo "INPUT_TFSEC_TRIVY: $INPUT_TFSEC_TRIVY"
echo "INPUT_TRIVY_SKIP_DIR: $INPUT_TRIVY_SKIP_DIR"
echo "INPUT_MAIN_BRANCH_NAME: $INPUT_MAIN_BRANCH_NAME"
echo "INPUT_USE_TRIVY_ECR_DATABASE: $INPUT_USE_TRIVY_ECR_DATABASE"
echo

# install tfsec from GitHub (taken from README.md)
if [[ -n "$INPUT_TFSEC_VERSION" && "${INPUT_TFSEC_TRIVY}" == "tfsec" ]]; then
env GO111MODULE=on go install github.com/aquasecurity/tfsec/cmd/tfsec@"${INPUT_TFSEC_VERSION}"
Expand All @@ -35,6 +37,12 @@ else
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin latest
fi

# use ECR for Trivy databases
if [[ "$INPUT_USE_TRIVY_ECR_DATABASE" == "true" ]];
export TRIVY_DB_REPOSITORY="public.ecr.aws/aquasecurity/trivy-db:2"
export TRIVY_JAVA_DB_REPOSITORY="public.ecr.aws/aquasecurity/trivy-java-db:1"
fi

line_break() {
echo
echo "*****************************"
Expand Down