From: Stefano Tondo <stondo@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: JPEWhacker@gmail.com, alex.kanavin@gmail.com,
stefan.herbrechtsmeier@weidmueller.com, paul@pbarker.dev,
mathieu.dubois-briand@bootlin.com, peter.marko@siemens.com,
stefano.tondo.ext@siemens.com
Subject: [PATCH v5 2/3] spdx30: Add the PURLs of the source downloads to the output packages
Date: Fri, 27 Nov 2026 00:07:31 +0100 [thread overview]
Message-ID: <20261126230732.2708012-3-stondo@gmail.com> (raw)
In-Reply-To: <20261126230732.2708012-1-stondo@gmail.com>
From: Stefano Tondo <stefano.tondo.ext@siemens.com>
Statically linked code, for example a Rust crate, is part of the
binary. But the SPDX of the output package only names the recipe, so
a vulnerability scanner that checks the packages of an image does not
find the dependency.
Add the PURLs of the source downloads to the external identifiers of
each output package. The software_packageUrl of the package stays the
first PURL in SPDX_PACKAGE_URLS.
All downloads with a PURL go in, also the ones that are not in the
binary. For example, a Cargo.lock lists crates that only run at build
time and crates for other platforms. So a scanner can report a crate
that the package does not contain. To leave such downloads out, the
SPDX needs a lifecycle scope for each dependency. That is a separate
proposal.
Signed-off-by: Stefano Tondo <stefano.tondo.ext@siemens.com>
---
meta/lib/oe/spdx30_tasks.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
index eded315819..8f4e3dc4fc 100644
--- a/meta/lib/oe/spdx30_tasks.py
+++ b/meta/lib/oe/spdx30_tasks.py
@@ -597,11 +597,11 @@ def add_custom_annotations(d, objset, obj):
)
-def set_purls(spdx_package, purls):
+def set_purls(spdx_package, purls, dependency_purls=()):
if purls:
spdx_package.software_packageUrl = purls[0]
- for p in sorted(set(purls)):
+ for p in sorted(set(purls) | set(dependency_purls)):
spdx_package.externalIdentifier.append(
oe.spdx30.ExternalIdentifier(
externalIdentifierType=oe.spdx30.ExternalIdentifierType.packageUrl,
@@ -979,6 +979,14 @@ def create_spdx(d):
source_files = add_download_files(d, build_objset)
build_inputs |= source_files
+ # The output packages inherit the PURLs of the downloads they are built
+ # from, as the code of statically linked dependencies is in them.
+ dependency_purls = {
+ dl.software_packageUrl
+ for dl in source_files
+ if getattr(dl, "software_packageUrl", None)
+ }
+
recipe_spdx_license = add_license_expression(
d, build_objset, d.getVar("LICENSE"), license_data, [recipe_objset]
)
@@ -1092,7 +1100,7 @@ def create_spdx(d):
or ""
).split()
- set_purls(spdx_package, purls)
+ set_purls(spdx_package, purls, dependency_purls)
pkg_objset.new_scoped_relationship(
[oe.sbom30.get_element_link_id(build)],
--
2.56.1
next prev parent reply other threads:[~2026-11-26 23:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 23:07 [PATCH v5 0/3] spdx30: identity and purls of dependency downloads Stefano Tondo
2026-11-26 23:07 ` [PATCH v5 1/3] spdx30: Take name, version and PURL of downloads from the fetcher Stefano Tondo
2026-11-26 23:07 ` Stefano Tondo [this message]
2026-11-26 23:07 ` [PATCH v5 3/3] oeqa/selftest: spdx: Test crate identity and output PURLs Stefano Tondo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126230732.2708012-3-stondo@gmail.com \
--to=stondo@gmail.com \
--cc=JPEWhacker@gmail.com \
--cc=alex.kanavin@gmail.com \
--cc=mathieu.dubois-briand@bootlin.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=paul@pbarker.dev \
--cc=peter.marko@siemens.com \
--cc=stefan.herbrechtsmeier@weidmueller.com \
--cc=stefano.tondo.ext@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox