Repository navigation
ci: prove a share change still generates product SBOMs #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
d7e0d5c
92da754
8ef25b9
da30e72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| name: SBOM product canary | ||
|
|
||
| # On a change to the vendored set, copy share/ into a temporary checkout of | ||
| # each ready product and generate that product's SBOM. The product | ||
| # repositories keep their pinned copy. This job does not push to them. | ||
| # | ||
| # wolfBoot is the plain-Make product. wolfTPM is the autotools product. | ||
| # Add a product here only after it vendors tools/sbom/. | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'share/**' | ||
| - 'VERSION' | ||
| - 'tools/wolfssl-compliance-tooling-sync' | ||
| - '.github/workflows/sbom-canary.yml' | ||
| push: | ||
| branches: [master] | ||
| paths: | ||
| - 'share/**' | ||
| - 'VERSION' | ||
| - 'tools/wolfssl-compliance-tooling-sync' | ||
| - '.github/workflows/sbom-canary.yml' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: sbom-canary-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| canary: | ||
| name: ${{ matrix.product }} | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 40 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - product: wolfboot | ||
| repository: wolfSSL/wolfBoot | ||
| name-prefix: wolfboot | ||
| - product: wolftpm | ||
| repository: wolfSSL/wolfTPM | ||
| name-prefix: wolftpm | ||
| steps: | ||
| - name: Checkout wolfssl-compliance-tooling | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: tooling | ||
|
|
||
| - name: Checkout ${{ matrix.product }} | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: ${{ matrix.repository }} | ||
| path: product | ||
|
|
||
| - name: Checkout wolfSSL | ||
| if: matrix.product == 'wolftpm' | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: wolfSSL/wolfssl | ||
| path: wolfssl | ||
|
|
||
| - name: Install build tools | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y build-essential autoconf automake libtool \ | ||
| pkg-config | ||
|
sameehj marked this conversation as resolved.
Resolved
|
||
|
|
||
| - name: Copy share into the product | ||
| run: | | ||
| python3 tooling/tools/wolfssl-compliance-tooling-sync \ | ||
| --src tooling \ | ||
| --dest product | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please pass |
||
|
|
||
| - name: Fetch the wolfBoot wolfSSL submodule | ||
| if: matrix.product == 'wolfboot' | ||
| working-directory: product | ||
| run: git submodule update --init --depth 1 -- lib/wolfssl | ||
|
|
||
| - name: Generate the wolfBoot SBOM | ||
| if: matrix.product == 'wolfboot' | ||
| working-directory: product | ||
| run: | | ||
| cp config/examples/sim.config .config | ||
| make sbom | ||
|
|
||
| - name: Build and install wolfSSL | ||
| if: matrix.product == 'wolftpm' | ||
| working-directory: wolfssl | ||
| run: | | ||
| autoreconf -ivf | ||
| ./configure --enable-wolftpm --enable-pkcallbacks \ | ||
| --prefix="$GITHUB_WORKSPACE/wolfssl-install" | ||
| make -j"$(nproc)" | ||
| make install | ||
|
|
||
| - name: Install pyspdxtools | ||
| if: matrix.product == 'wolftpm' | ||
| run: | | ||
| # configure records PYSPDXTOOLS. Install the tool before configure. | ||
| python3 -m pip install --user 'spdx-tools==0.8.*' | ||
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | ||
|
|
||
| - name: Configure and build wolfTPM | ||
| if: matrix.product == 'wolftpm' | ||
| working-directory: product | ||
| run: | | ||
| autoreconf -ivf | ||
| ./configure --enable-swtpm --disable-fwtpm --disable-examples \ | ||
| --with-wolfcrypt="$GITHUB_WORKSPACE/wolfssl-install" | ||
| make -j"$(nproc)" | ||
|
|
||
| - name: Generate the wolfTPM SBOM | ||
| if: matrix.product == 'wolftpm' | ||
| working-directory: product | ||
| run: make sbom WOLFSSL_DIR="$GITHUB_WORKSPACE/wolfssl" | ||
|
|
||
| - name: Validate the SBOM | ||
| working-directory: product | ||
| env: | ||
| NAME_PREFIX: ${{ matrix.name-prefix }} | ||
| run: | | ||
| shopt -s nullglob | ||
| files=("${NAME_PREFIX}"-*.cdx.json "${NAME_PREFIX}"-*.spdx.json) | ||
| if [ "${#files[@]}" -eq 0 ]; then | ||
| echo "ERROR: no SBOM files matched ${NAME_PREFIX}-*.cdx.json or ${NAME_PREFIX}-*.spdx.json." >&2 | ||
| exit 1 | ||
| fi | ||
| python3 tools/sbom/validate_sbom.py \ | ||
| --name-prefix "$NAME_PREFIX" \ | ||
| "${files[@]}" | ||
|
|
||
| - name: Assert no host path leak | ||
| working-directory: product | ||
| env: | ||
| NAME_PREFIX: ${{ matrix.name-prefix }} | ||
| run: | | ||
| shopt -s nullglob | ||
| files=("${NAME_PREFIX}"-*.cdx.json "${NAME_PREFIX}"-*.spdx.json) | ||
| # A published SBOM must not contain build-machine absolute paths. | ||
| # grep exit 0 = match (fail), 1 = clean, >=2 = real error. | ||
| set +e | ||
| out="$(grep -REn '"/(home|Users|root)/' "${files[@]}")" | ||
| rc=$? | ||
| if [ "$rc" -eq 0 ]; then | ||
| echo "ERROR: absolute host path found in SBOM:" >&2 | ||
| echo "$out" >&2 | ||
| exit 1 | ||
| elif [ "$rc" -ne 1 ]; then | ||
| echo "ERROR: could not scan SBOM outputs." >&2 | ||
| exit 1 | ||
| fi | ||
| echo "OK: no host path leak." | ||
|
|
||
| - name: Upload SBOM | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: sbom-canary-${{ matrix.product }} | ||
| path: | | ||
| product/${{ matrix.name-prefix }}-*.cdx.json | ||
| product/${{ matrix.name-prefix }}-*.spdx.json | ||
| if-no-files-found: error | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -193,5 +193,10 @@ $(1): $($(2)PREREQS) | |
| $(if $($(2)SPDX_OUT),--spdx-out "$($(2)SPDX_OUT)") | ||
| endef | ||
|
|
||
| # Products vendored before the rename still call wolfglass_sbom_rule. | ||
| # Keep that name so a sync does not break their Makefile. | ||
| # Use a recursive reference, not $(value): $(call) must expand $(1) and $(2). | ||
| wolfglass_sbom_rule = $(wolfssl_compliance_tooling_sbom_rule) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The CMake helper needs the same alias. wolfBoot macro(wolfglass_add_sbom)
wolfssl_compliance_tooling_add_sbom(${ARGN})
endmacro()The canary misses it because neither job builds through CMake. A CMake step in the wolfTPM job would cover it. Line 197 restates line 196 and can go. |
||
|
|
||
| SBOM_TARGET ?= sbom | ||
| $(eval $(call wolfssl_compliance_tooling_sbom_rule,$(SBOM_TARGET),SBOM_)) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth a line here that both products build from their default branch, so a break there fails our
share/PRs.