Repository navigation
The SBOM of a release carries a serial number, so the release can attest it - #1151
Conversation
…ld refuses one the SBOM attestation would refuse actions/attest-sbom takes a CycloneDX document only when bomFormat, specVersion and serialNumber are all set. cyclonedx-py writes no serial number under --output-reproducible, so the 4.0.0 run failed at "Attest the SBOM" with "Unsupported SBOM format" after the files were on PyPI. A rehearsal attests nothing, so no rehearsal could see it. scripts/release_sbom.py now writes the serial number as urn:uuid: and the version 5 UUID, in the URL namespace, of pkg:pypi/phonometry@<version>, "#" and the SHA-256 of the finished document without its serial number. One SBOM of a release gets the same serial number every time it is written, and two SBOMs that differ, even of one release, never share one, as the CycloneDX schema asks of every BOM: a rehearsal run again after numpy publishes a release writes another document. The script reports an SBOM without bomFormat CycloneDX, without specVersion, with a serial number out of the schema's form, or larger than the 16 MiB the attestation reads, in the build job, where a rehearsal runs it too, and then writes nothing. The new tests apply the predicate of actions/attest to the file the script writes, check the serial number against RFC 9562 and SHA-256 computed by hand, check that two writings of one document give the same bytes and that another numpy gives another serial number, and hold the size limit to the byte. Against the script of 4.0.0, 14 of them fail.
…every release after it does The 4.0.0 run uploaded to PyPI and recorded the build provenance of all four files, then stopped at the SBOM attestation; the tag and the GitHub Release were made by hand from the files that run built. SECURITY.md promised an SBOM attestation for every release from 4.0.0 on and showed the command for 4.0.0, which finds nothing. It now says which releases carry it, shows that command for a release after 4.0.0, and says that the rebuild on macOS after the release did not run for 4.0.0, while Python CI had rebuilt the same commit on macOS to the bytes the release published. The CHANGELOG says what was fixed.
…, and the build refuses an SBOM a tool at another version wrote requirements-release.txt pinned cyclonedx-bom 8.0.1 and left the library that writes the document to its range, cyclonedx-python-lib>=8,<12. The library writes its own version into metadata.tools, so the SBOM of one release written with 11.11.0 and with 11.12.0 differs at that line, under the same serial number. The file now pins everything cyclonedx-bom installs on the Python 3.13 the release runs, as pip resolves it today, so Dependabot moves each of them in a pull request. scripts/release_sbom.py also holds every tool the SBOM names in metadata.tools to the version requirements-release.txt pins (cyclonedx-py is the command of cyclonedx-bom), and writes nothing when one differs or is not pinned. Against the pins of 4.0.0, the SBOM 4.0.0 published is refused for cyclonedx-python-lib 11.12.0, and so is an SBOM written today with 11.11.0. Two writings of the SBOM of the 4.0.0 wheel, each from its own environment and its own cyclonedx-py run, now give the same bytes. The CHANGELOG entry says what that holds to.
…ier of the wheel's attestation is pinned Two steps of a release run nothing a rehearsal or a pull request runs first. PyPI refuses an unknown Trove classifier at the upload, and setuptools checks the classifiers of pyproject.toml only when trove-classifiers is installed, which requirements-release.txt did not install. A scratch commit that adds the classifier "Topic :: Scientific/Engineering :: Acoustics :: Not A Real One" built with the release tooling and passed twine check --strict; with trove-classifiers 2026.9.21.13 beside it, the same build stops at "project.classifiers[9] must be trove-classifier". The pinned list now makes the build, in a rehearsal and on every pull request, refuse what the upload would. The release files of the current tree are the same bytes with it and without it. The job that installs the published version from PyPI verified the PEP 740 attestation of the wheel with whatever pypi-attestations was newest that day. It now installs it, with everything it brings, from requirements-attestations.txt, read from a sparse checkout of that one file (the job now holds contents: read for it, as the verify job does), so Dependabot moves the verifier in a pull request; the pinned verifier passes on phonometry 4.0.0 as PyPI serves it. A test reads every pip install of release.yml and publish-stub.yml and accepts a pinned requirements file, the run's own wheel, the version it published and pip itself, and nothing else.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 46 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1151 +/- ##
=======================================
Coverage 97.35% 97.35%
=======================================
Files 477 477
Lines 97722 97722
=======================================
Hits 95136 95136
Misses 2586 2586 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Numerical conformance1899/1899 checks pass across 111 domains, against 230 normative designations and 121 further published sources. Used in the tables below is how much of that clause's published tolerance the deviation consumes: 100 % sits exactly on the limit, 5 % uses a twentieth of the allowance, and a dash means the clause states no two-sided tolerance for the quantity, so there is no budget to spend. It is reported and never used to decide a verdict, which is settled at full precision before any rounding. Nothing moved: same 1899 checks, same verdicts, same numbers. Closest to their published limit (top 5) The rows with the least room left, so the ones a change is most likely to push over.
|
|



What was wrong
The 4.0.0 release run (https://github.com/jmrplens/phonometry/actions/runs/44065469371) uploaded the wheel and the sdist to PyPI, recorded the build provenance of the wheel, the sdist, the checksum file and the SBOM, and then failed at "Attest the SBOM" with
Unsupported SBOM format. Must be valid SPDX or CycloneDX JSON.actions/attest-sbomtakes a CycloneDX document only whenbomFormat,specVersionandserialNumberare all set, and the release writes the SBOM withcyclonedx-py environment ... --output-reproducible, which leaves the serial number out. A rehearsal never calls the attestation, so no rehearsal could have shown it.I made the v4.0.0 tag and GitHub Release by hand from the files that run built and attested. 4.0.0 therefore has its build provenance and its PEP 740 attestations on PyPI but no SBOM attestation, and the rebuild on macOS after the release did not run for it; Python CI had rebuilt the same commit on macOS, and its checksums equal the published
phonometry-4.0.0.sha256byte for byte.Looking at what else a release runs before anything a rehearsal or a pull request has run, I found three more:
cyclonedx-python-lib, which writes its own version into the SBOM, was not pinned; PyPI refuses an unknown Trove classifier only at the upload; and the job that verifies the PEP 740 attestation of the published wheel installed whateverpypi-attestationswas newest that day.What is now true
scripts/release_sbom.pywrites the serial number:urn:uuid:and the version 5 UUID (RFC 9562, URL namespace) ofpkg:pypi/phonometry@<version>,#and the SHA-256 of the finished document without its serial number, keys sorted. One SBOM of a release always gets the same serial number and so the same bytes; two different SBOMs never share one, as the CycloneDX schema asks. A serial number the tool wrote is replaced.bomFormatother thanCycloneDX, nospecVersion, a serial number out of the schema'surn:uuid:form, or a file larger than the 16 MiB the attestation reads. It runs in the build job, so a rehearsal now fails on what stopped 4.0.0.requirements-release.txtpins everythingcyclonedx-bominstalls on the Python 3.13 the release runs, and the script refuses an SBOM whosemetadata.toolsnames a tool at a version that file does not pin. Written again, the SBOM of a release differs only in what pip resolves that day.requirements-release.txtalso pinstrove-classifiers, so setuptools holds the classifiers ofpyproject.tomlto the list PyPI takes and the build refuses one PyPI would refuse, in a rehearsal and on every pull request. The release files of the current tree are the same bytes with it and without it.pypi-attestationsand everything it installs pinned in the newrequirements-attestations.txt, read from a sparse checkout of that one file; the job now holdscontents: readfor that checkout. Dependabot's pip entry at the root covers the new file.SECURITY.mdsays that 4.0.0 has no SBOM attestation and why, shows the SBOM attestation command for a release after 4.0.0, and says that the rebuild after the release did not run for 4.0.0. The release steps inCONTRIBUTING.mdsay what a rehearsal and a release now check. The CHANGELOG has a Fixed entry under[Unreleased].How I checked it
tests/test_release_tooling.pyapply the predicate ofsrc/sbom.tsinactions/attestto the file the script writes, compute the serial number by hand from RFC 9562 andhashlib, check that two writings of one document give the same bytes and that another numpy gives another serial number, hold the size limit to the byte, and hold the SBOM's tools to the pins.tests/test_release_workflow.pychecks that the build installs the classifier list, and reads everypip installofrelease.ymlandpublish-stub.yml, accepting only a pinned requirements file, the run's own wheel, the version it published and pip itself.serialNumber). Finished by the new script it gains only"serialNumber": "urn:uuid:6d699f7f-4167-5ee7-b9a9-7d6a4a24265d", the predicate accepts it, the strict JSON validator ofcyclonedx-python-lib11.12.0 for CycloneDX 1.6 finds no error, and finishing it again gives the same bytes. Two fresh writings of the SBOM of the 4.0.0 wheel, each in its own environment with the pinned tools, finish to exactly those bytes.Topic :: Scientific/Engineering :: Acoustics :: Not A Real Onebuilt and passedtwine check --strictwith the 4.0.0 pins; with the new pins the build stops atconfiguration error: `project.classifiers[9]` must be trove-classifier.requirements-attestations.txton Python 3.14, printsOK: phonometry-4.0.0-py3-none-any.whlfor the wheel PyPI serves.ruff check,ruff format --check,mypy src scripts stub/src tests/static_typingand baremypy,bandit,zizmor, the Markdown prose guards and the 16 test modules that read the release tooling,SECURITY.md,CONTRIBUTING.mdandCHANGELOG.md(1318 passed, 7 skipped) are clean.make llmschanges nothing, and the 4.0.0 release notes written from this CHANGELOG are the same bytes as before.What this does not do
actions/attest-sbom; the build job holds the SBOM to the same checks instead, so a release remains the first run that calls the action itself.SECURITY.mdshows<version>until the next release is stamped.