Add system library dependencies to Fromager SBOM via auditwheel#292
Add system library dependencies to Fromager SBOM via auditwheel#292ronnll wants to merge 1 commit into
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds a post-repair step that inspects manylinux wheels with auditwheel to discover system-provided shared library dependencies and injects them into the Fromager SBOM as SPDX Packages with DEPENDS_ON relationships. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 security issue, and left some high level feedback:
Security issues:
- Detected subprocess function 'run' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'. (link)
General comments:
- Consider hardening the auditwheel output parsing logic (e.g., handling unexpected formats, missing sections, or future auditwheel changes) so that failures degrade gracefully without breaking the wheel build or corrupting the SBOM.
- It may be worth ensuring the new add-system-deps-to-sbom step is idempotent (e.g., not duplicating SPDX Package/DEPENDS_ON entries when re-run) to avoid subtle SBOM growth or inconsistencies in incremental or retried builds.
- Since this script relies on auditwheel and manylinux-specific behavior, consider isolating any platform- or tool-specific assumptions behind small helper functions so future changes (e.g., non-manylinux targets or different tools) are easier to support.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider hardening the auditwheel output parsing logic (e.g., handling unexpected formats, missing sections, or future auditwheel changes) so that failures degrade gracefully without breaking the wheel build or corrupting the SBOM.
- It may be worth ensuring the new add-system-deps-to-sbom step is idempotent (e.g., not duplicating SPDX Package/DEPENDS_ON entries when re-run) to avoid subtle SBOM growth or inconsistencies in incremental or retried builds.
- Since this script relies on auditwheel and manylinux-specific behavior, consider isolating any platform- or tool-specific assumptions behind small helper functions so future changes (e.g., non-manylinux targets or different tools) are easier to support.
## Individual Comments
### Comment 1
<location path="builder/scripts/test-add-system-deps" line_range="276-277" />
<code_context>
r = subprocess.run([sys.executable, str(SCRIPT_DIR / "add-system-deps-to-sbom"), str(whl)],
capture_output=True, text=True)
</code_context>
<issue_to_address>
**security (python.lang.security.audit.dangerous-subprocess-use-audit):** Detected subprocess function 'run' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'.
*Source: opengrep*
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@jvulgan PTAL. The script has helper functions which are intentionally kept this way instead of being added to the main function for a more fail safe approach. Also, this was tested locally with the test-add-system-deps, but ill double check by by inspecting a package when merged. Lastly,, this was mostly generated by Claude but I've checked each line to ensure it's accurate. Sorry it's a bit long, but please feel free to ask any questions you have. |
|
@jvulgan updated, ptal! |
Wheels built by Calunga can link against system-provided shared libraries, but this information was missing from the SBOM shipped inside each wheel. This adds a new add-system-deps-to-sbom script that runs auditwheel show on each manylinux wheel after repair, parses the system library references and their versioned symbols, and injects them as SPDX Package entries with DEPENDS_ON relationships in the Fromager SBOM. Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
|
@jvulgan changes made. PTAL! |
|
/lgtm |
Wheels built by Calunga can link against system-provided shared libraries, but this information was missing from the SBOM shipped inside each wheel. This adds a new add-system-deps-to-sbom script that runs auditwheel show on each manylinux wheel after repair, parses the system library references and their versioned symbols, and injects them as SPDX Package entries with DEPENDS_ON relationships in the Fromager SBOM.
Assisted-by: Claude Opus 4.6 noreply@anthropic.com
Summary by Sourcery
Augment Fromager-generated SBOMs for manylinux wheels with system library dependency information derived from auditwheel output.
New Features:
Tests: