Skip to content

Commit 08e4e75

Browse files
authored
[CRAVEX] SCA Integrations: OWASP dep-scan (#1825)
Signed-off-by: tdruez <[email protected]>
1 parent 8a4708d commit 08e4e75

File tree

4 files changed

+3974
-0
lines changed

4 files changed

+3974
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Generate SBOM with OWASP dep-scan and load into ScanCode.io
2+
3+
# This workflow:
4+
# 1. Generates a CycloneDX SBOM for a container image using OWASP dep-scan.
5+
# 2. Uploads the SBOM as a GitHub artifact for future inspection.
6+
# 3. Loads the SBOM into ScanCode.io for further analysis.
7+
# 4. Runs assertions to verify that the SBOM was properly processed in ScanCode.io.
8+
#
9+
# It runs on demand, and once a week (scheduled).
10+
11+
on:
12+
workflow_dispatch:
13+
schedule:
14+
# Run once a week (every 7 days) at 00:00 UTC on Sunday
15+
- cron: "0 0 * * 0"
16+
17+
permissions:
18+
contents: read
19+
20+
env:
21+
IMAGE_REFERENCE: "python:3.13.0-slim"
22+
23+
jobs:
24+
generate-and-load-sbom:
25+
runs-on: ubuntu-24.04
26+
steps:
27+
- name: Install OWASP dep-scan
28+
run: |
29+
sudo npm install -g @cyclonedx/cdxgen
30+
pip install owasp-depscan
31+
32+
- name: Generate SBOM with OWASP dep-scan
33+
run: |
34+
depscan \
35+
--src ${{ env.IMAGE_REFERENCE }} \
36+
--type docker \
37+
--reports-dir reports \
38+
--explain
39+
40+
- name: Upload SBOM as GitHub Artifact
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: depscan-sbom
44+
path: reports/
45+
retention-days: 20
46+
47+
- name: Uninstall dep-scan to avoid conflicts in the Python env
48+
run: pip uninstall --yes owasp-depscan
49+
50+
- name: Import SBOM into ScanCode.io
51+
uses: aboutcode-org/scancode-action@main
52+
with:
53+
pipelines: "load_sbom"
54+
inputs-path: "reports/sbom-docker.vdr.json"
55+
56+
- name: Verify SBOM Analysis Results in ScanCode.io
57+
shell: bash
58+
run: |
59+
scanpipe shell --command "from scanpipe.models import DiscoveredPackage, DiscoveredDependency; package_manager = DiscoveredPackage.objects; assert package_manager.count() > 220; assert package_manager.vulnerable().count() > 10; assert DiscoveredDependency.objects.count() > 150"

docs/faq.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ are actively supported and tested::
375375

376376
- Anchore: https://anchore.com/sbom/
377377
- CycloneDX cdxgen: https://cyclonedx.github.io/cdxgen/
378+
- OWASP dep-scan: https://owasp.org/www-project-dep-scan/
378379
- Trivy: https://trivy.dev/latest/
379380

380381
.. note:: Imported SBOMs must follow the SPDX or CycloneDX standards, in JSON format.

0 commit comments

Comments
 (0)