remove poor permission setting #16
Workflow file for this run
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
name: Trivy Security Scanner | |
on: | |
push: | |
branches: | |
- 6-22.04 | |
pull_request: | |
jobs: | |
build: | |
name: Build rock | |
uses: canonical/data-platform-workflows/.github/workflows/build_rock.yaml@v29.0.1 | |
scan: | |
name: Trivy scan and SBOM Generation | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Install required dependencies | |
run: | | |
# rockcraft | |
sudo snap install rockcraft --classic --edge | |
# yq | |
sudo snap install yq | |
- name: Download rock package(s) | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: ${{ needs.build.outputs.artifact-prefix }}-* | |
merge-multiple: true | |
- name: Import locally | |
run: | | |
full_version="$(cat rockcraft.yaml | yq .version)" | |
sudo rockcraft.skopeo --insecure-policy \ | |
copy \ | |
oci-archive:charmed-mongodb_${full_version}_amd64.rock \ | |
docker-daemon:trivy/charmed-mongodb:test | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: "trivy/charmed-mongodb:test" | |
format: "sarif" | |
output: "trivy-results.sarif" | |
severity: "MEDIUM,HIGH,CRITICAL" | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
if: always() | |
with: | |
sarif_file: "trivy-results.sarif" | |
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph | |
uses: aquasecurity/trivy-action@master | |
with: | |
scan-type: "image" | |
format: "spdx-json" | |
output: "dependency-results.sbom.json" | |
image-ref: "trivy/charmed-mongodb:test" | |
github-pat: ${{ secrets.GITHUB_TOKEN }} | |
severity: "MEDIUM,HIGH,CRITICAL" | |
scanners: "vuln" | |
- name: Upload trivy report as a Github artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: trivy-sbom-report | |
path: "${{ github.workspace }}/dependency-results.sbom.json" | |
retention-days: 90 |