forked from intel/cve-bin-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
9,587 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
name: SBOM generation | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# Runs at 02:00 UTC every Monday | ||
- cron: '2 0 * * 1' | ||
|
@@ -9,45 +10,51 @@ jobs: | |
sbom_gen: | ||
name: Generate SBOM | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
continue-on-error: true | ||
strategy: | ||
matrix: | ||
python: ['3.7', '3.8', '3.9', '3.10', '3.11'] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
python-version: ${{ matrix.python }} | ||
cache: 'pip' | ||
cache-dependency-path: '**/requirements.txt' | ||
- name: Get date | ||
id: get-date | ||
run: | | ||
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | ||
- name: Get cached database | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/cve-bin-tool | ||
key: ${{ runner.os }}-cve-bin-tool-${{ steps.get-date.outputs.date }} | ||
- name: Install dependencies and cve-bin-tool | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade setuptools | ||
python -m pip install --upgrade wheel | ||
python -m pip install --upgrade pytest | ||
python -m pip install --upgrade sbom4python | ||
pip install . -r doc/requirements.txt | ||
pip install . --upgrade --upgrade-strategy=eager | ||
- name: Generate SBOM for cve-bin-tool | ||
run: | | ||
sbom4python --module cve-bin-tool --output sbom/cve-bin-tool.spdx | ||
sbom4python --module cve-bin-tool --sbom cyclonedx --format json --output sbom/cve-bin-tool.json | ||
# - name: Compare SBOM for cve-bin-tool | ||
# # This would fail due to time/date of SBOM generation in SBOM header | ||
# # Therefore ignore first 10 lines of file in comparison which is SBOM header | ||
# run: | | ||
# /bin/tail -n +10 sbom/cve-bin-tool.spdx > orig | ||
# /bin/tail -n +10 cve-bin-tool.spdx > new | ||
# /bin/diff -b orig new | ||
# - name: Display generated SBOM if difference detected | ||
# if: ${{ failure() }} | ||
# run: | | ||
# /bin/cat cve-bin-tool.spdx | ||
|
||
sbom4python --module cve-bin-tool --output cve-bin-tool-py${{ matrix.python }}.spdx | ||
sbom4python --module cve-bin-tool --sbom cyclonedx --format json --output cve-bin-tool-py${{ matrix.python }}.json | ||
- name: Compare SBOM for cve-bin-tool | ||
id: diff-sbom | ||
# This would fail due to time/date of SBOM generation in SBOM header | ||
# Therefore ignore first 10 lines of file in comparison which is SBOM header | ||
run: | | ||
/bin/tail -n +10 sbom/cve-bin-tool-py${{ matrix.python }}.spdx > orig | ||
/bin/tail -n +10 cve-bin-tool-py${{ matrix.python }}.spdx > new | ||
echo "changed=$(/bin/diff -q orig new)" >> $GITHUB_OUTPUT | ||
- name: Display generated SBOM if difference detected | ||
if: ${{ steps.diff-sbom.outputs.changed }} | ||
run: | | ||
/bin/cat cve-bin-tool-py${{ matrix.python }}.spdx | ||
- name: Update existing SBOM if difference detected | ||
if: ${{ steps.diff-sbom.outputs.changed }} | ||
run: | | ||
cp cve-bin-tool-py${{ matrix.python }}.spdx sbom/cve-bin-tool-py${{ matrix.python }}.spdx | ||
cp cve-bin-tool-py${{ matrix.python }}.json sbom/cve-bin-tool-py${{ matrix.python }}.json | ||
- name: Create Pull Request | ||
if: ${{ steps.diff-sbom.outputs.changed }} | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
commit-message: "chore: update SBOM for Python ${{ matrix.python }}" | ||
title: "chore: update SBOM for Python ${{ matrix.python }}" | ||
branch: chore-sbom-py${{ matrix.python }} | ||
delete-branch: true | ||
author: GitHub <[email protected]> | ||
add-paths: sbom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright (C) 2023 Orange | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
|
||
""" | ||
CVE checker for capnproto: | ||
https://www.cvedetails.com/product/37224/Capnproto-Capnproto.html?vendor_id=16364 | ||
""" | ||
from cve_bin_tool.checkers import Checker | ||
|
||
|
||
class CapnprotoChecker(Checker): | ||
CONTAINS_PATTERNS: list[str] = [] | ||
FILENAME_PATTERNS: list[str] = [] | ||
VERSION_PATTERNS = [ | ||
r"Cap'n Proto version ([0-9]+\.[0-9]+\.[0-9]+)", | ||
r"libcapnp-([0-9]+\.[0-9]+\.[0-9]+)", | ||
] | ||
VENDOR_PRODUCT = [("capnproto", "capnproto")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.