feat: add sbom Makefile target#85
Open
MarkAtwood wants to merge 1 commit into
Open
Conversation
Adds sbom target that calls gen-sbom to produce CycloneDX and SPDX output files. Extracts version from WOLFSENTRY_VERSION_MAJOR/MINOR/TINY macros in wolfsentry/wolfsentry.h. Sources enumerated from src/*.c. Requires WOLFSSL_DIR or GEN_SBOM pointing to gen-sbom.
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds a make sbom target to generate CycloneDX and SPDX SBOM artifacts for wolfsentry.
Changes:
- Extracts wolfsentry version from
wolfsentry/wolfsentry.hand uses it to name SBOM outputs. - Locates and invokes
gen-sbom, generating both CycloneDX and SPDX JSON outputs. - Captures compiler preprocessor defines into a temp header for
gen-sbominput.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+559
to
+563
| sbom: | ||
| $(Q)if [ -z "$(SBOM_VERSION)" ] || [ "$(SBOM_VERSION)" = ".." ]; then \ | ||
| echo "ERROR: could not extract version from wolfsentry/wolfsentry.h" 1>&2; \ | ||
| exit 1; \ | ||
| fi |
Comment on lines
+586
to
+589
| _srcs=""; \ | ||
| for _f in $(SRCS); do _srcs="$$_srcs $(SRC_TOP)/src/$$_f"; done; \ | ||
| python3 "$$_gen_sbom" \ | ||
| --name wolfsentry \ |
Comment on lines
+582
to
+585
| if ! $(CC) -dM -E -I'$(SRC_TOP)' -x c /dev/null >"$$_defines_h" 2>/dev/null; then \ | ||
| echo "ERROR: $(CC) -dM -E failed" 1>&2; \ | ||
| exit 1; \ | ||
| fi; \ |
Comment on lines
+595
to
+596
| --cdx-out "$(BUILD_TOP)/$(SBOM_CDX)" \ | ||
| --spdx-out "$(BUILD_TOP)/$(SBOM_SPDX)" |
Comment on lines
+553
to
+555
| SBOM_CDX = wolfsentry-$(SBOM_VERSION).cdx.json | ||
| SBOM_SPDX = wolfsentry-$(SBOM_VERSION).spdx.json | ||
| SBOM_SPDX_TV = wolfsentry-$(SBOM_VERSION).spdx |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
make sbomtarget that produces CycloneDX and SPDX SBOM files for wolfsentry.WOLFSENTRY_VERSION_MAJOR/MINOR/TINYmacros inwolfsentry/wolfsentry.hsrc/*.c(sorted)gen-sbom(located viaGEN_SBOMorWOLFSSL_DIR/scripts/gen-sbom)WOLFSSL_DIRis only needed to locate gen-sbomUsage
```sh
With WOLFSSL_DIR (points gen-sbom location):
make sbom WOLFSSL_DIR=/path/to/wolfssl/source
Or with explicit gen-sbom path:
make sbom GEN_SBOM=/path/to/wolfssl/scripts/gen-sbom
```
Outputs:
wolfsentry-<version>.cdx.json,wolfsentry-<version>.spdx.jsonRequirements
gen-sbomfrom a wolfssl tree containingscripts/gen-sbom(available on thefeat/sbom-embeddedbranch of wolfssl)python3on the build hostTest plan
make sbom WOLFSSL_DIR=...