Skip to content

fix(sbom): fail on an unreadable --options-h and on TARGETS with LIB - #50

Open
Frauschi wants to merge 1 commit into
masterfrom
fix/driver-reject-bad-inputs
Open

Frauschi wants to merge 1 commit into
masterfrom
fix/driver-reject-bad-inputs

Conversation

@Frauschi

Copy link
Copy Markdown
Member

What

Two input mistakes that produced a misleading result now fail early.

  • Unreadable --options-h: gen-sbom warned and wrote an SBOM with an empty build configuration and exit status 0. It now exits with the path and the OS error.
  • TARGETS with LIB: the driver already rejects --lib with --srcs-file. The CMake helper now rejects TARGETS with LIB at configure time, and sbom.mk rejects SBOM_SRCS with SBOM_LIB before calling the driver. A LIB left as <VAR>-NOTFOUND by a failed find_library() now stops configure with "LIB was not found"; next to TARGETS it used to be dropped silently.
  • The driver's message for a missing checksum source names all three options, and share/README.md says "pick one" instead of "at least one" (the leftover nit from sbom: record a traced library, zlib, and explicit dependency versions #37).

Tests

  • test_missing_file_exits in test_gen_sbom.py, a configure-failure test in test_sbom_cmake_install.py (both set, and -NOTFOUND with and without TARGETS), and in test_sbom.py the missing-source message plus the sbom.mk check through make.
  • Independent of the other two open follow-ups; all three merge cleanly in any order and pass together.

gen-sbom printed a warning and recorded no build configuration when it
could not read --options-h, so a typo in the path produced an SBOM with
an empty configuration and a zero exit status. It now exits with the path
and the OS error.

The driver already rejects --lib together with --srcs-file. The CMake
helper and sbom.mk now reject TARGETS with LIB (SBOM_SRCS with SBOM_LIB)
themselves, so the mistake shows at configure time or before the driver
runs instead of as a driver error from inside the sbom target. The
helper also stops at configure time on a LIB left as <VAR>-NOTFOUND by a
failed find_library(); next to TARGETS such a value used to be dropped
silently. The
driver's message for a missing checksum source now names all three
options, and share/README.md says "pick one" where it said "at least
one".
Copilot AI balanced review requested due to automatic review settings October 22, 2026 17:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused validation changes match the driver contract and include regression coverage, with no blocking issues identified in static review; tests were not executed.

No open issues 🎉

What changed in this PR

This PR tightens SBOM input validation so unreadable configuration files and conflicting checksum sources fail explicitly rather than produce misleading output.

Changes:

  • Fail with the path and OS error when --options-h cannot be read.
  • Reject conflicting composition inputs in CMake and Make, and reject unresolved CMake library paths.
  • Clarify checksum-source guidance and add regression coverage.
File Description
tests/​test_sbom.py Tests missing-source diagnostics and conflicting Make inputs.
tests/​test_sbom_cmake_install.py Tests configure failures for conflicting inputs and unresolved libraries.
tests/​test_gen_sbom.py Tests failure when the options header is missing.
share/​sbom-driver.py Names all three checksum-source options in the diagnostic.
share/​README.md Clarifies that composition inputs are mutually exclusive.
share/​gen-sbom Exits with an error when the options header is unreadable.
share/​build/​sbom.mk Rejects simultaneous source and library inputs.
share/​build/​sbom.cmake Rejects conflicting inputs and unresolved library paths.

Review effort: Balanced

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