-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use Trivy more effectively The current image scanning workflow leads to Trivy scans being run twice because the test action is run on both PRs and pushes to main. To rectify this, a new security action has been added in this commit that only runs on PRs to scan both the permissions-api Git repository and Docker image. Additionally, repo scanning has been added to the image-build action and a typo in the image tag to be scanned has been fixed. Signed-off-by: John Schaeffer <[email protected]> * Set exit code for Trivy jobs since they seem to run now Signed-off-by: John Schaeffer <[email protected]> * Fix Trivy findings in dev container Dockerfile Signed-off-by: John Schaeffer <[email protected]> * Disable config scanner until it gets more better Signed-off-by: John Schaeffer <[email protected]> * Adjust whitespace in dev container Dockerfile Signed-off-by: John Schaeffer <[email protected]> --------- Signed-off-by: John Schaeffer <[email protected]>
- Loading branch information
1 parent
a4b55d3
commit fa28655
Showing
4 changed files
with
87 additions
and
17 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
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,67 @@ | ||
name: Trivy Scan | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
image-scan: | ||
name: image-scan | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Registry login | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker metadata | ||
id: metadata | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=sha | ||
- name: Build | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: false | ||
load: true | ||
tags: ${{ steps.metadata.outputs.tags }} | ||
|
||
- name: Scan image | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: ${{ steps.metadata.outputs.tags }} | ||
scanners: 'vuln,secret' | ||
ignore-unfixed: true | ||
severity: 'HIGH,CRITICAL' | ||
format: 'table' | ||
exit-code: '1' | ||
|
||
repo-scan: | ||
name: repo-scan | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Scan repo | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
scan-type: 'fs' | ||
scan-ref: '.' | ||
scanners: 'vuln,secret' | ||
ignore-unfixed: true | ||
severity: 'HIGH,CRITICAL' | ||
format: 'table' | ||
exit-code: '1' |
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