Skip to content

fix(deps): validate --dep-* as yes/no; normalize make/cmake fragments - #17

Open
MarkAtwood wants to merge 2 commits into
masterfrom
fix/dep-flag-yes-no
Open

fix(deps): validate --dep-* as yes/no; normalize make/cmake fragments#17
MarkAtwood wants to merge 2 commits into
masterfrom
fix/dep-flag-yes-no

Conversation

@MarkAtwood

Copy link
Copy Markdown

gen-sbom built enabled_deps with flag.lower() == 'yes', silently treating any other value (1, true, on, Y, empty) as no. A fragment wiring --dep-wolfssl=$(HAVE_WOLFSSL) to a truthy-but-not-yes value would drop a CVE-bearing dependency from the SBOM with no warning — exactly the failure a CRA tool must not make quietly. Now validates each --dep-* against {yes,no} and exits on anything else.

Also normalizes sbom.mk and sbom.cmake to enable a dependency only on an exact yes (matching sbom.am), instead of forwarding on mere non-emptiness — so a no/empty value is no longer forwarded. sbom.am was already correct and is unchanged.

New tests/test_dep_flags.py (yes records the dep, no omits it, and 1/true/on/Y/"" now fail loudly), wired into selftest.yml. Full gen-sbom suite unchanged (162).

Overlaps: gen-sbom is also touched by #15 (identity), different region; selftest.yml by several PRs. Addresses SBOM-gpex.7.

sameehj and others added 2 commits July 23, 2026 15:54
Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>
gen-sbom built enabled_deps with `flag.lower() == 'yes'`, silently
treating any other value (1, true, on, Y, empty) as 'no'. A build
fragment wiring --dep-wolfssl=$(HAVE_WOLFSSL) to a truthy-but-not-'yes'
value would drop a CVE-bearing dependency from the SBOM with no warning.
Validate each --dep-* against {yes,no} and sys.exit on anything else.

Also normalize the make and cmake fragments to enable a dependency only
on an exact 'yes' (matching sbom.am), instead of forwarding on mere
non-emptiness -- so a 'no'/empty value is no longer forwarded.

Adds tests/test_dep_flags.py (yes records, no omits, bad values fail
loudly), wired into selftest.yml.
Copilot AI review requested due to automatic review settings July 24, 2026 04:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Tightens SBOM dependency-flag handling to prevent silent dependency omissions by validating gen-sbom --dep-* inputs and aligning build-system fragments to only enable dependencies on an explicit yes. Adds CI coverage for the new validation behavior.

Changes:

  • Validate all --dep-* inputs in share/gen-sbom against {yes,no} and exit on any other value.
  • Normalize sbom.mk and sbom.cmake to only forward dependency flags when explicitly enabled with yes.
  • Add tests/test_dep_flags.py and wire it into .github/workflows/selftest.yml.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/test_dep_flags.py Adds unit tests ensuring --dep-* values are strictly validated and affect SBOM component inclusion.
share/gen-sbom Enforces {yes,no} validation for dependency flags and builds enabled_deps from validated inputs.
share/build/sbom.mk Updates Make fragment to only pass --dep-* when the variable is exactly yes.
share/build/sbom.cmake Updates CMake helper to only pass --dep-* when the value is exactly yes.
.github/workflows/selftest.yml Adds the new dep-flag test to syntax-check and unittest execution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_dep_flags.py
Comment on lines +4 to +6
A value that is neither (1, true, on, an empty string) must fail loudly rather
than be silently treated as 'no' -- a silently dropped dependency hides a
CVE-bearing component from the SBOM."""
Comment thread share/build/sbom.mk
Comment on lines +76 to +77
$(if $(filter yes,$(SBOM_DEP_WOLFSSL)),--dep-wolfssl yes) \
$(if $(filter yes,$(SBOM_DEP_OPENSSL)),--dep-openssl yes) \
Comment thread share/build/sbom.cmake
Comment on lines +132 to 139
# Enable only on an exact "yes" (matching sbom.am), so a "no"/empty value
# is not forwarded as a dependency; gen-sbom validates the value it receives.
if(SB_DEP_WOLFSSL STREQUAL "yes")
list(APPEND _cmd --dep-wolfssl yes)
endif()
if(SB_DEP_OPENSSL)
list(APPEND _cmd --dep-openssl ${SB_DEP_OPENSSL})
if(SB_DEP_OPENSSL STREQUAL "yes")
list(APPEND _cmd --dep-openssl yes)
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants