Skip to content

Commit 5f4c37c

Browse files
aksOpsclaude
andcommitted
Replace Snyk with SBOM + pip-audit dependency scan workflow
- Remove Snyk badge (needs PyPI publication) - Add sbom.yml: generates CycloneDX SBOM, scans ALL dependencies (direct + transitive) with pip-audit, license audit with pip-licenses - Uploads SBOM + audit report as downloadable artifacts (90 day retention) - Runs on every push, weekly, and manual trigger - Dynamic badge shows workflow pass/fail status Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 53cf042 commit 5f4c37c

2 files changed

Lines changed: 76 additions & 1 deletion

File tree

.github/workflows/sbom.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: SBOM + Dependency Audit
2+
3+
on:
4+
push:
5+
branches: [main]
6+
schedule:
7+
- cron: "0 6 * * 1"
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
sbom-and-audit:
15+
name: Generate SBOM & scan dependencies
16+
runs-on: ubuntu-latest
17+
continue-on-error: true
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
26+
- name: Install project + tools
27+
run: |
28+
pip install .
29+
pip install pip-audit cyclonedx-bom pip-licenses
30+
31+
- name: Generate CycloneDX SBOM (JSON)
32+
run: |
33+
cyclonedx-py environment \
34+
--output-format json \
35+
--outfile sbom-cyclonedx.json \
36+
2>&1 || cyclonedx-py --format json -o sbom-cyclonedx.json 2>&1 || true
37+
echo "CycloneDX SBOM generated"
38+
39+
- name: Generate dependency list with licenses
40+
run: |
41+
pip-licenses --format=json --with-urls --with-description > dependencies-licenses.json
42+
pip-licenses --format=plain --with-urls
43+
echo ""
44+
echo "=== License summary ==="
45+
pip-licenses --summary
46+
47+
- name: Audit dependencies for vulnerabilities
48+
run: |
49+
echo "=== Scanning all installed packages (including transitive) ==="
50+
pip-audit --desc --format=json --output=audit-report.json 2>&1 || true
51+
echo ""
52+
echo "=== Audit Results ==="
53+
pip-audit --desc 2>&1 || true
54+
55+
- name: Count results
56+
run: |
57+
echo "=== Installed packages ==="
58+
pip list --format=columns | wc -l
59+
echo ""
60+
echo "=== Direct dependencies ==="
61+
python3 -c "import tomli; deps=tomli.load(open('pyproject.toml','rb'))['project']['dependencies']; print(f'{len(deps)} direct dependencies')"
62+
echo ""
63+
echo "=== Transitive dependencies ==="
64+
pip list --format=json | python3 -c "import sys,json; pkgs=json.load(sys.stdin); print(f'{len(pkgs)} total packages installed (direct + transitive)')"
65+
66+
- name: Upload SBOM artifact
67+
if: always()
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: sbom-report
71+
path: |
72+
sbom-cyclonedx.json
73+
dependencies-licenses.json
74+
audit-report.json
75+
retention-days: 90

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<a href="https://github.com/RandomCodeSpace/code-iq/releases"><img src="https://img.shields.io/github/v/release/RandomCodeSpace/code-iq?include_prereleases&style=flat-square&logo=github&label=Release" alt="Release"></a>
1212
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.11%2B-blue?style=flat-square&logo=python&logoColor=white" alt="Python 3.11+"></a>
1313
<a href="https://github.com/RandomCodeSpace/code-iq/blob/main/LICENSE"><img src="https://img.shields.io/github/license/RandomCodeSpace/code-iq?style=flat-square&label=License" alt="MIT License"></a>
14-
<a href="https://app.snyk.io"><img src="https://img.shields.io/snyk/vulnerabilities/github/RandomCodeSpace/code-iq?style=flat-square&logo=snyk&label=Snyk" alt="Snyk Vulnerabilities"></a>
14+
<a href="https://github.com/RandomCodeSpace/code-iq/actions/workflows/sbom.yml"><img src="https://img.shields.io/github/actions/workflow/status/RandomCodeSpace/code-iq/sbom.yml?branch=main&style=flat-square&logo=shieldsdotio&logoColor=white&label=SBOM%20%2B%20Audit" alt="SBOM + Dependency Audit"></a>
1515
<a href="https://sonarcloud.io/summary/overall?id=RandomCodeSpace_code-iq"><img src="https://sonarcloud.io/api/project_badges/measure?project=RandomCodeSpace_code-iq&metric=security_rating&style=flat-square" alt="Sonarcloud Security"></a>
1616
<a href="https://sonarcloud.io/summary/overall?id=RandomCodeSpace_code-iq"><img src="https://sonarcloud.io/api/project_badges/measure?project=RandomCodeSpace_code-iq&metric=reliability_rating" alt="Sonarcloud Reliability"></a>
1717
<a href="https://sonarcloud.io/summary/overall?id=RandomCodeSpace_code-iq"><img src="https://sonarcloud.io/api/project_badges/measure?project=RandomCodeSpace_code-iq&metric=sqale_rating" alt="Sonarcloud Maintainability"></a>

0 commit comments

Comments
 (0)