Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
52 changes: 52 additions & 0 deletions .github/workflows/CIS-Anchore-Grype.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# https://github.com/anchore/grype
# https://github.com/anchore/scan-action

name: Anchore Grype Vulnerability Scan (Container Image Scanning)

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: 0 1 * * 0

env:
fail-build: false # Set to true to fail the build if vulnerabilities are found
imageName: "webapp01"
tag: ${{ github.sha }}

jobs:
anchore-grype-scan:
name: Anchore Grype Vulnerability Scan

runs-on: ubuntu-latest

permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build an image from Dockerfile
uses: docker/build-push-action@v4

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'CIS - Anchore Grype Vulnerability Scan (Container Image Scanning)' step
Uses Step
uses 'docker/build-push-action' with ref 'v4', not a pinned commit hash
with:
tags: "${{ env.imageName }}:${{ env.tag }}"
push: false
load: true

- name: Run the Anchore Grype scan action
uses: anchore/scan-action@v6

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'CIS - Anchore Grype Vulnerability Scan (Container Image Scanning)' step
Uses Step: scan
uses 'anchore/scan-action' with ref 'v6', not a pinned commit hash
id: scan
with:
image: "${{ env.imageName }}:${{ env.tag }}"
fail-build: ${{ env.fail-build }}
severity-cutoff: critical

- name: Upload Anchore vulnerability report to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
49 changes: 49 additions & 0 deletions .github/workflows/CIS-Trivy-AquaSecurity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# https://trivy.dev/latest/
# https://github.com/aquasecurity/trivy
# https://github.com/aquasecurity/trivy-action

name: Trivy Container Image Scanning

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: 0 1 * * 0

env:
imageName: "webapp01"
tag: ${{ github.sha }}

jobs:
trivy:
name: Trivy vulnerability scanner

runs-on: ubuntu-latest

permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build an image from Dockerfile
run: |
docker build ./src/webapp01 --file ./src/webapp01/Dockerfile --tag ${{ env.imageName }}:${{ env.tag }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.29.0

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'CIS - Trivy Container Image Scanning' step
Uses Step
uses 'aquasecurity/trivy-action' with ref '0.29.0', not a pinned commit hash
with:
image-ref: "${{ env.imageName }}:${{ env.tag }}"
format: "sarif"
output: "trivy-results.sarif"

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: "trivy-results.sarif"
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement

name: 'SCA - Dependency Review'

on:
pull_request:
branches: [ "main" ]

permissions:
contents: read
# Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option
pull-requests: write

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
# Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options.
with:
comment-summary-in-pr: always
fail-on-severity: 'moderate'
allow-licenses: MIT, Apache-2.0

Loading