|
| 1 | + |
| 2 | +name: SBOM Vulnerability Scanning |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +jobs: |
| 8 | + sbom: |
| 9 | + runs-on: ubuntu-22.04 |
| 10 | + container: |
| 11 | + image: python:3.13-slim |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Install Poetry and Tools |
| 18 | + run: | |
| 19 | + apt-get update && apt-get install -y curl |
| 20 | + curl -sSL https://install.python-poetry.org | python3 - |
| 21 | + export PATH="$HOME/.local/bin:$PATH" |
| 22 | + pip install cyclonedx-bom grype tabulate |
| 23 | +
|
| 24 | + - name: Install dependencies |
| 25 | + run: | |
| 26 | + export PATH="$HOME/.local/bin:$PATH" |
| 27 | + poetry install |
| 28 | +
|
| 29 | + # Generate SBOM in JSON |
| 30 | + - name: Generate SBOM (CycloneDX) |
| 31 | + run: | |
| 32 | + cyclonedx-py --format json --output sbom.json |
| 33 | +
|
| 34 | + # Convert SBOM JSON to CSV |
| 35 | + - name: Convert SBOM JSON to CSV |
| 36 | + run: | |
| 37 | + python .github/scripts/sbom_json_to_csv.py sbom.json sbom.csv |
| 38 | +
|
| 39 | + - name: Upload SBOM artifacts |
| 40 | + uses: actions/upload-artifact@v4 |
| 41 | + with: |
| 42 | + name: sbom-files |
| 43 | + path: | |
| 44 | + sbom.json |
| 45 | + sbom.csv |
| 46 | +
|
| 47 | + # Scan SBOM for vulnerabilities |
| 48 | + - name: Scan SBOM for Vulnerabilities |
| 49 | + run: | |
| 50 | + grype sbom:sbom.json -o json > grype-report.json |
| 51 | +
|
| 52 | + # Convert Grype JSON to CSV |
| 53 | + - name: Convert Grype JSON to CSV |
| 54 | + run: | |
| 55 | + python .github/scripts/grype_json_to_csv.py grype-report.json grype-report.csv |
| 56 | +
|
| 57 | + - name: Upload Vulnerability Report |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: grype-report |
| 61 | + path: | |
| 62 | + grype-report.json |
0 commit comments