-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: tweak the security workflows (#147)
* ci: tweak the security workflows * ci: trigger CI * ci: always run security jobs * ci: add Docker scanning * ci: drop `x86` support * ci: tweak `image-ref` * ci: list all docker images * ci: use image id directly for scan * ci: limit sarif severities * ci: remove list images * ci: toggle `TRIVY_TF_EXCLUDE_DOWNLOADED_MODULES` to `false` * ci: limit Terraform to critical issues For now, until the 42 other issues are ignored or resolved. * chore: remove trigger CI comments * ci: bump `aquasecurity/trivy-action`
- Loading branch information
1 parent
72591c9
commit fad089f
Showing
5 changed files
with
74 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,13 +108,19 @@ jobs: | |
with: | ||
context: ${{ env.WORKING_DIR }} | ||
target: production | ||
platforms: linux/amd64,linux/arm64 | ||
platforms: linux/arm64 | ||
push: ${{ inputs.push }} | ||
load: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Scan | ||
uses: aquasecurity/[email protected] | ||
with: | ||
image-ref: ${{ steps.build-and-push.outputs.imageid }} | ||
|
||
- name: Setup Notation CLI | ||
if: ${{ inputs.push }} | ||
uses: notaryproject/notation-action/setup@v1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,39 @@ | ||
name: Security App | ||
name: Security | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
type: string | ||
required: false | ||
project: | ||
type: string | ||
required: true | ||
schedule: | ||
# Weekly on Monday at 00:00 UTC | ||
- cron: 0 0 * * 1 | ||
|
||
jobs: | ||
dependency-scan-api: | ||
if: github.event_name == 'schedule' || inputs.project == 'api' | ||
name: API | ||
app-scan: | ||
name: App | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: app/api | ||
env: | ||
# Temporary until this repository becomes a mono-repository: https://dvsa.atlassian.net/browse/VOL-4961. | ||
REMOTE_REPOSITORY: dvsa/olcs-backend | ||
working-directory: app | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ env.REMOTE_REPOSITORY }} | ||
repository: dvsa/olcs-backend | ||
path: app/api | ||
- name: Setup Snyk | ||
uses: snyk/actions/setup@master | ||
- name: Scan api repository | ||
run: snyk test --sarif-file-output=snyk-results.sarif | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
|
||
- name: Upload Results to GitHub Code Scanning | ||
if: ${{ always() }} | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: app/api/snyk-results.sarif | ||
|
||
dependency-scan-selfserve: | ||
if: github.event_name == 'schedule' || inputs.project == 'selfserve' | ||
name: Selfserve | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: app/selfserve | ||
env: | ||
# Temporary until this repository becomes a mono-repository: https://dvsa.atlassian.net/browse/VOL-4961. | ||
REMOTE_REPOSITORY: dvsa/olcs-selfserve | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ env.REMOTE_REPOSITORY }} | ||
repository: dvsa/olcs-selfserve | ||
path: app/selfserve | ||
- name: Setup Snyk | ||
uses: snyk/actions/setup@master | ||
- name: Scan selfserve repository | ||
run: snyk test --sarif-file-output=snyk-results.sarif | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
|
||
- name: Upload Results to GitHub Code Scanning | ||
if: ${{ always() }} | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: app/selfserve/snyk-results.sarif | ||
|
||
dependency-scan-internal: | ||
if: github.event_name == 'schedule' || inputs.project == 'internal' | ||
name: Internal | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: app/internal | ||
env: | ||
# Temporary until this repository becomes a mono-repository: https://dvsa.atlassian.net/browse/VOL-4961. | ||
REMOTE_REPOSITORY: dvsa/olcs-internal | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ env.REMOTE_REPOSITORY }} | ||
repository: dvsa/olcs-internal | ||
path: app/internal | ||
- name: Setup Snyk | ||
uses: snyk/actions/setup@master | ||
- name: Scan internal repository | ||
run: snyk test --sarif-file-output=snyk-results.sarif | ||
- name: Scan | ||
run: snyk test --sarif-file-output=snyk-results.sarif --all-projects | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
|
||
- name: Upload Results to GitHub Code Scanning | ||
if: ${{ always() }} | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: app/internal/snyk-results.sarif | ||
sarif_file: app/snyk-results.sarif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Security | ||
|
||
on: | ||
workflow_call: | ||
schedule: | ||
# Weekly on Monday at 00:00 UTC | ||
- cron: 0 0 * * 1 | ||
|
||
jobs: | ||
docker-scan: | ||
name: Docker | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Scan | ||
uses: aquasecurity/[email protected] | ||
with: | ||
exit-code: 1 | ||
scan-ref: "infra/docker" | ||
scan-type: "config" | ||
format: "sarif" | ||
output: "trivy-results.sarif" | ||
severity: "MEDIUM,HIGH,CRITICAL" | ||
limit-severities-for-sarif: true | ||
- name: Upload Results to GitHub Code Scanning | ||
if: ${{ always() }} | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: "trivy-results.sarif" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,27 @@ | ||
name: Security Terraform | ||
name: Security | ||
|
||
on: | ||
workflow_call: | ||
schedule: | ||
# Weekly on Monday at 00:00 UTC | ||
- cron: 0 0 * * 1 | ||
|
||
env: | ||
TRIVY_TF_EXCLUDE_DOWNLOADED_MODULES: true | ||
|
||
jobs: | ||
terraform-scan: | ||
name: Terraform Scan | ||
name: Terraform | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Scan Terraform | ||
uses: aquasecurity/trivy-action@master | ||
- name: Scan | ||
uses: aquasecurity/[email protected] | ||
with: | ||
exit-code: 1 | ||
scan-ref: "infra/terraform" | ||
scan-type: "config" | ||
format: "sarif" | ||
output: "trivy-results.sarif" | ||
|
||
severity: "CRITICAL" | ||
limit-severities-for-sarif: true | ||
- name: Upload Results to GitHub Code Scanning | ||
if: ${{ always() }} | ||
uses: github/codeql-action/upload-sarif@v3 | ||
|