|
| 1 | +# CMMC supply-chain CI. Adds vulnerability scanning and SBOM generation |
| 2 | +# on every push + PR so 800-171 Rev 2 controls 3.14.1 / 3.11.2 / 3.4.1 |
| 3 | +# have continuous evidence, not just pre-assessment snapshots. |
| 4 | +# |
| 5 | +# Kept in a separate file from upstream's ci.yaml so a monthly |
| 6 | +# rebase does not generate merge conflicts on the compliance additions. |
| 7 | +# |
| 8 | +# Controls: |
| 9 | +# 3.14.1 Identify/report/correct system flaws in a timely manner |
| 10 | +# 3.11.2 Scan for vulnerabilities periodically + when new vulns identified |
| 11 | +# 3.4.1 Establish + maintain baseline configurations + inventories (SBOM) |
| 12 | +# 3.13.11 FIPS-validated cryptography — reproduced via build verification |
| 13 | +name: CMMC Supply Chain |
| 14 | + |
| 15 | +on: |
| 16 | + push: |
| 17 | + branches: |
| 18 | + - "cmmc/main" |
| 19 | + pull_request: |
| 20 | + |
| 21 | +# Default permissions are read-only; individual jobs opt into more |
| 22 | +# (trivy-fs needs security-events:write to post SARIF). |
| 23 | +permissions: |
| 24 | + contents: read |
| 25 | + |
| 26 | +jobs: |
| 27 | + govulncheck: |
| 28 | + name: Go Vulnerability Check (3.14.1) |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v6 |
| 32 | + - uses: actions/setup-go@v6 |
| 33 | + with: |
| 34 | + go-version: "1.26.x" |
| 35 | + - name: Install govulncheck |
| 36 | + run: go install golang.org/x/vuln/cmd/govulncheck@latest |
| 37 | + - name: Run govulncheck |
| 38 | + run: govulncheck ./... |
| 39 | + |
| 40 | + trivy-fs: |
| 41 | + name: Trivy Filesystem Scan (3.11.2) |
| 42 | + runs-on: ubuntu-latest |
| 43 | + permissions: |
| 44 | + contents: read |
| 45 | + security-events: write # scoped: only this job uploads SARIF |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v6 |
| 48 | + - name: Run Trivy vulnerability scanner |
| 49 | + # Pinned to a specific release rather than @master to keep the |
| 50 | + # supply-chain scanner itself supply-chain-clean (3.4.1 irony). |
| 51 | + uses: aquasecurity/trivy-action@0.28.0 |
| 52 | + with: |
| 53 | + scan-type: "fs" |
| 54 | + scan-ref: "." |
| 55 | + format: "sarif" |
| 56 | + output: "trivy-fs.sarif" |
| 57 | + severity: "CRITICAL,HIGH" |
| 58 | + exit-code: "1" |
| 59 | + ignore-unfixed: true |
| 60 | + - name: Upload SARIF to GitHub Security |
| 61 | + if: always() |
| 62 | + uses: github/codeql-action/upload-sarif@v4 |
| 63 | + with: |
| 64 | + sarif_file: "trivy-fs.sarif" |
| 65 | + category: "trivy-fs" |
| 66 | + |
| 67 | + sbom: |
| 68 | + name: Generate SBOM (3.4.1) |
| 69 | + runs-on: ubuntu-latest |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v6 |
| 72 | + - uses: actions/setup-go@v6 |
| 73 | + with: |
| 74 | + go-version: "1.26.x" |
| 75 | + - name: Install Syft |
| 76 | + run: | |
| 77 | + curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b "$HOME/.local/bin" |
| 78 | + echo "$HOME/.local/bin" >> "$GITHUB_PATH" |
| 79 | + - name: Generate SBOMs (SPDX + CycloneDX, single scan) |
| 80 | + # One filesystem walk, two output formats. Avoids scanning the |
| 81 | + # tree twice as the action-based variants would. |
| 82 | + run: | |
| 83 | + syft . -o spdx-json=sbom.spdx.json -o cyclonedx-json=sbom.cdx.json |
| 84 | + - name: Upload SBOM artifacts |
| 85 | + uses: actions/upload-artifact@v4 |
| 86 | + with: |
| 87 | + name: sbom |
| 88 | + path: | |
| 89 | + sbom.spdx.json |
| 90 | + sbom.cdx.json |
| 91 | + retention-days: 90 |
| 92 | + |
| 93 | + fips-build-verify: |
| 94 | + name: FIPS Build Reproducibility (3.13.11) |
| 95 | + runs-on: ubuntu-latest |
| 96 | + steps: |
| 97 | + - uses: actions/checkout@v6 |
| 98 | + - uses: actions/setup-go@v6 |
| 99 | + with: |
| 100 | + go-version: "1.26.x" |
| 101 | + - name: Build with GOFIPS140=v1.0.0 |
| 102 | + run: | |
| 103 | + GOFIPS140=v1.0.0 go build -trimpath -buildvcs=false -o filebrowser-fips . |
| 104 | + - name: Verify FIPS module enabled at runtime |
| 105 | + run: | |
| 106 | + cat > /tmp/fipscheck.go <<'EOF' |
| 107 | + package main |
| 108 | + import ( |
| 109 | + "crypto/fips140" |
| 110 | + "fmt" |
| 111 | + "os" |
| 112 | + ) |
| 113 | + func main() { |
| 114 | + if !fips140.Enabled() { |
| 115 | + fmt.Println("FIPS 140 NOT enabled — regression") |
| 116 | + os.Exit(1) |
| 117 | + } |
| 118 | + fmt.Println("FIPS 140 enabled — OK") |
| 119 | + } |
| 120 | + EOF |
| 121 | + GOFIPS140=v1.0.0 go run /tmp/fipscheck.go |
0 commit comments