Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/sca-integration-depscan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Generate SBOM with OWASP dep-scan and load into ScanCode.io

# This workflow:
# 1. Generates a CycloneDX SBOM for a container image using OWASP dep-scan.
# 2. Uploads the SBOM as a GitHub artifact for future inspection.
# 3. Loads the SBOM into ScanCode.io for further analysis.
# 4. Runs assertions to verify that the SBOM was properly processed in ScanCode.io.
#
# It runs on demand, and once a week (scheduled).

on:
workflow_dispatch:
schedule:
# Run once a week (every 7 days) at 00:00 UTC on Sunday
- cron: "0 0 * * 0"

permissions:
contents: read

env:
IMAGE_REFERENCE: "python:3.13.0-slim"

jobs:
generate-and-load-sbom:
runs-on: ubuntu-24.04
steps:
- name: Install OWASP dep-scan
run: |
sudo npm install -g @cyclonedx/cdxgen
pip install owasp-depscan
- name: Generate SBOM with OWASP dep-scan
run: |
depscan \
--src ${{ env.IMAGE_REFERENCE }} \
--type docker \
--reports-dir reports \
--explain
- name: Upload SBOM as GitHub Artifact
uses: actions/upload-artifact@v4
with:
name: depscan-sbom
path: reports/
retention-days: 20

- name: Uninstall dep-scan to avoid conflicts in the Python env
run: pip uninstall --yes owasp-depscan

- name: Import SBOM into ScanCode.io
uses: aboutcode-org/scancode-action@main
with:
pipelines: "load_sbom"
inputs-path: "reports/sbom-docker.vdr.json"

- name: Verify SBOM Analysis Results in ScanCode.io
shell: bash
run: |
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"
1 change: 1 addition & 0 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ are actively supported and tested::

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

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