Commit Graph
26 Commits
Author SHA1 Message Date
Christoph Reiter 09cf7c9e02 sbom: add support for exracting versions from CPEs
* properly implement unescaping for v2.3 CPEs
* extend the CPE we write to the sbom with the version
* always write v2.2 CPEs to the sbom since those are easier to build
* in case a CPE contains a version, use that over pkgver

Fixes #12
2025-02-20 22:53:21 +01:00
Christoph Reiter 1e26635972 pkgextra: sync with msys2-web 2025-02-16 19:06:24 +01:00
Christoph Reiter f5f3d7c47d pypi-cache: support pypi PURLs as well
once this is also supported in msys2-web we can get rid of the pypi mapping
2025-02-16 19:00:04 +01:00
Christoph Reiter a8f48c79f8 merge pkgextra parsing logic again
it was extended to allow duplicate keys at some point
to support PURL, and just forked. Update the other users
to deal with this again and merge teh code.
2025-02-16 18:53:26 +01:00
Christoph Reiter 321362210d sbom: support versions in PURLs
In case a PURL reference has a version included we use that instead
of the pkgver.

This is helpful in case the version format is different on pypi for
example, or when referencing github and the version tag is prefixed with "v".
2025-02-16 17:46:47 +01:00
Christoph Reiter 5fe2218493 sbom: add multiple pkgbase if they match
We have multiple packages with the same CPE, and since we now have
multiple components with the same name they get merged by grype into
one, which means each SBOM component can point to multiple pkgbase
values.
2024-12-23 15:10:20 +01:00
Christoph Reiter da03cb0a01 sbom: fix component name values for purl components
In case of components with purl the name has to match the name of
the project as encoded in the prul (for whatever reason) or otherwise
grype will not find any CVEs for them.

Currently we are using the name match pkgbase, so we can connect
vulns to packages in msys2-web.

With this no longer working add a "msys2:pkgbase" property to the SBOM.
But since grype throws out everything non-essential from the input SBOM
add a command that merges the property from the source to the enriched
SBOM. And since we can't even have an ID to connect components there
match by comparing various fields (name, version, cpe, purl).

This means the new process is like this:

* Generate SBOM with "sbom create"
* Run grype to generate cdx SBOM with VEX
* Add properties to grype SBOM via "sbom merge"
* In msys2-web instead of taking "name" look for a property called "msys2:pkgbase"

While at it also use the CPE project name for the SBOM component name, and
remove the version from the CPE, since grype doesn't seem to use it, and
we avoid having to escape things in the CPE.

And also try to normalize versions a bit.
2024-12-23 14:13:52 +01:00
Christoph Reiter 8b688c5b64 map mingw_arch to msys2_arch instead
let's not invent another new key not used anywhere else
2024-09-15 15:02:57 +02:00
Christoph Reiter 7ef284f001 Add a very basic linting command for repos/srcinfos
Nothing much, just a start
2024-08-16 19:27:00 +02:00
Christoph Reiter 531424ff53 Add proper srcinfo parsing code 2024-08-16 18:15:08 +02:00
Christoph Reiter 9062996bbc remove debug code 2024-03-25 15:02:26 +01:00
Christoph Reiter c757ecee0f sbom: also write out components for things without cpe/purl
can't hurt, to test fuzzy matching
2024-03-25 12:24:56 +01:00
Christoph Reiter 7da42c70fa sbom: support multiple CPEs and PURLs per package
Just write them out as separate components with the same name,
since cyclonedx doesn't support multiple IDs per components.
2024-03-25 12:01:42 +01:00
Christoph Reiter c23f1b58e4 pypi: normalize package names
so the pypi reference doesn't have to 100% match the package name
on pypi
2024-03-24 16:30:19 +01:00
Christoph Reiter 82be58200f sbom: also allow full CPE keys as value
re-using he first part of the CPE as a key in our format is a bit
hacky, so better move to "cpe: cpe:/a:haxx:curl" to avoid any confusion.
2024-03-24 15:32:41 +01:00
Christoph Reiter acfd1335b2 sbom: add purl support
In case a package specifies a purl, use it as is
2024-03-24 15:21:38 +01:00
Christoph Reiter 2e293c7c58 Add a hacky tool to write out a SBOM
only supports packages with a pypi reference or a CPE atm.
2024-03-19 09:05:22 +01:00
Christoph Reiter 583ba1da8f New command for introspecting signature files in the repos
Fixes #6
2023-12-09 14:50:25 +01:00
Christoph Reiter a7b1877d98 srcinfo_cache: validate the extra fields somwhat
so it errors out when parsing in CI instead of in msys2-web
2023-09-17 21:10:33 +02:00
Christoph Reiter 1a09e02b25 Port pypi-cache away from PKGMETA.yml
read the information from the srcinfo file instead
2023-09-17 21:10:13 +02:00
Christoph Reiter 5be6f1b262 srcinfo-cache: include extra metadata extracted from the PKGBUILDs
Bash variables starting with msys2_ or mingw_ in the PKGBUILD will
now be included in the srcinfo cache under "extra". This supports
both strings and arrays of strings.
2023-09-17 17:35:24 +02:00
Christoph Reiter 9294a0dc5e Update dependencies
and port to pydantic v2
2023-07-18 08:28:53 +02:00
Christoph Reiter 50841db83d remove debug print 2023-07-03 09:26:07 +02:00
Christoph Reiter 015e0265b1 Add a pypi metadata cache command 2023-07-03 09:04:03 +02:00
Christoph Reiter ffe7da3157 Add CI 2023-04-11 07:42:01 +02:00
Christoph Reiter 0b7885227f Add ci-generate-srcinfo.py as an entry point 2023-04-11 06:41:08 +02:00