Skip to content

Adding nightly and PR trivy scans #17

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
22 changes: 22 additions & 0 deletions .github/workflows/scan:trivy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Trivy Terraform Scan

on:
pull_request:
branches: [main]
schedule:
- cron: '0 3 * * *' # Nightly at 03:00 UTC
workflow_dispatch:

jobs:
trivy:
runs-on: ubuntu-latest

permissions:
contents: read
issues: write

steps:
- uses: actions/checkout@v4

- name: Trivy scan
uses: corelight/shared-actions/trivy-terraform-scan@main
7 changes: 6 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ tasks:
fmt:check:
desc: Check if the input is formatted
cmds:
- terraform fmt -recursive -check -diff .
- terraform fmt -recursive -check -diff .

trivy:scan:
desc: Scan Terraform files with Trivy
cmds:
- trivy fs --config scripts/trivy/trivy.yml .
1 change: 1 addition & 0 deletions scripts/trivy/.trivyignore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
misconfigurations:
19 changes: 19 additions & 0 deletions scripts/trivy/trivy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
scan:
security-checks:
- secret
- config

ignorefile: scripts/trivy/.trivyignore.yml

severity:
- HIGH
- CRITICAL

misconfiguration:
scanners:
- terraform
config:
terraform:
file_patterns:
- "**/*.tf"
ignore_unfixed: true