-
Notifications
You must be signed in to change notification settings - Fork 27
feat: add pypi attestation discovery #1067
New issue
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? No Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Ben Selwyn-Smith <benselwynsmith@googlemail.com>
b97a9cb
to
a362d7c
Compare
Signed-off-by: Ben Selwyn-Smith <benselwynsmith@googlemail.com>
2df212b
to
6d7cf95
Compare
Signed-off-by: Ben Selwyn-Smith <benselwynsmith@googlemail.com>
logger.debug("No predicate in payload statement.") | ||
return None, None | ||
|
||
repo = json_extract(predicate, ["sourceUri"], str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the documentation for the predicate of https://docs.pypi.org/attestations/publish/v1/
, currently its content is not defined. I wonder if the sourceUri
and sourceDigest
was copied from an existing implementation or it's purposely put here to catch these data if they are available in the future?
I have decoded the statement of https://pypi.org/integrity/ultralytics/8.3.119/ultralytics-8.3.119.tar.gz/provenance and got
{
"_type": "https://in-toto.io/Statement/v1",
"subject": [
{
"name": "ultralytics-8.3.119.tar.gz",
"digest": {
"sha256": "497bdcf3eb1beb082f451d42e5af2a6af944693a5991c78a9b9b0ce538593153"
}
}
],
"predicateType": "https://docs.pypi.org/attestations/publish/v1",
"predicate": null
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may have confused things by converting the certificate information into a predicate and attaching it to the pypi spec that has none. The type and the related function could be renamed to better distinguish them from the actual spec. The actual field names within the substitute predicate were chosen for simplicity, and loosely based on existing predicates I suppose.
Summary
This PR adds discovery of PyPI attestation. URLs to these attestation files are sought via the deps.dev API.
Description of changes
DepsDevRepoFinder
was updated to use theDepsDevService
, ensuring consistent and easily configurable use of the APIDepsDevRepoFinder
functions (they were not added previously), including for the functions that PyPI attestation discovery relies upon.pypi-attestation
is used to extract information from the attestation certificate. This information is coerced into a predicate for use elsewhere within Macaron.ultralytics
Python library as its target.Related issues
Closes #947