-
Notifications
You must be signed in to change notification settings - Fork 963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “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? Sign in to your account
Verify release URLs using Trusted Publisher information #16205
Conversation
I think this is probably fine as-is for now, as it will cover the majority of use cases, but once we support verifying URLs when attestations are uploaded we should revisit this to re-verify URLs when a file is added to a release (and, likely, add any additional URLs that were not present on the first file, if there are any). |
|
In the future we might have attestations that are not related to a publish that could add additional verification, but I think this is an edge case we can consider later. If we want to include updates here to handle verification for subsequent file uploads that would be fine too! |
@di For verifying URLs of existing releases (when the user uploads files that are not the first file of that release), do we want to verify the URLs using the Trusted Publisher iff the file is successfully uploaded? The alternative would be to also allow marking URLs as verified for any Trusted Publishing upload attempt that is correctly authenticated, even if the file ends up not being successfully uploaded. |
5065bbd
to
a1f2fbc
Compare
I think only a successful upload makes sense. There are many reasons why an upload would fail, I don't think it's necessary to tease apart which ones would still make verification valid and which ones might not. |
a1f2fbc
to
19d4e21
Compare
Signed-off-by: Javan lacerda <javanlacerda@google.com>
Move verification to its own function, and make the verification checks more exhaustive by parsing the URL and adding more test cases.
19d4e21
to
7fd4b59
Compare
I pushed a commit for verifying also URLs of existing releases. Now, if a file is uploaded for an existing release, we update the verified status of the release's URLs if they were not verified but the current file upload did verify them. |
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.
LGTM, thanks @facutuesca! We should follow this up with the appropriate project/release view changes 🙂
warehouse/migrations/versions/26455e3712a2_create_verified_field_for_releaseurl.py
Show resolved
Hide resolved
warehouse/migrations/versions/26455e3712a2_create_verified_field_for_releaseurl.py
Outdated
Show resolved
Hide resolved
…ld_for_releaseurl.py
This changeset appears to have introduced some warnings in the test suite: tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://github.com/foo-False]
tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://github.com/foo/bar/-True]
tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://github.com/foo/bar-True]
/opt/warehouse/src/tests/unit/forklift/test_legacy.py:3906: SAWarning: SELECT statement has a cartesian product between FROM element(s) "releases" and FROM element "release_urls". Apply join condition(s) between each element to resolve.
db_request.db.query(ReleaseURL).filter(Release.project == project).one()
tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://google.com-False]
/opt/warehouse/src/tests/unit/forklift/test_legacy.py:3906: SAWarning: SELECT statement has a cartesian product between FROM element(s) "release_urls" and FROM element "releases". Apply join condition(s) between each element to resolve.
db_request.db.query(ReleaseURL).filter(Release.project == project).one()
tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_publisher_verifies_existing_release_url
/opt/warehouse/src/tests/unit/forklift/test_legacy.py:3984: SAWarning: SELECT statement has a cartesian product between FROM element(s) "releases" and FROM element "release_urls". Apply join condition(s) between each element to resolve.
db_request.db.query(ReleaseURL).filter(Release.project == project).all() Curious - why would these query not leverage the relationship? warehouse/tests/unit/forklift/test_legacy.py Line 3906 in 8a5ad08
warehouse/tests/unit/forklift/test_legacy.py Line 3984 in 8a5ad08
|
Looking into it now |
PR open to fix it here: #16528 |
PR to prevent recurrence here: #16529 |
This PR builds on top of the work in #15891. The goal is to:
verified
boolean field to eachReleaseURL
that is set toTrue
if the URL matches the Trusted Publisher URLgithub.com/user/project
should appear as verified if the release was uploaded using a GitHub Actions Trusted Publisher configured withgithub.com/user/project
as its identity.Closes #15891.