Skip to content

Add base_publisher_url to file/release events. #15872

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

Closed
wants to merge 3 commits into from

Conversation

di
Copy link
Member

@di di commented Apr 26, 2024

This fixes an issue with #15862, where the publisher_url for most events contained a commit SHA, and therefore had additional parts that made it hard to compare with project URLs.

The workaround is to introduce a base_publisher_url additional field that represents the unique "root" of the publisher for all publishers (i.e. the github repo) which we can use to compare to project URLs to verify them.

This means that these links will become verified only once a new event is published with this additional field, which should slowly happen over time.

To speed this up, we could do a one-off data migration to add base_publisher_url to existing events, but I think this should be fine as-is.

@di di requested a review from a team as a code owner April 26, 2024 17:36
)
DBFileEventFactory.create(
source=release_file,
tag="fake:event",
additional={"publisher_url": publisher_url},
additional={"base_publisher_url": base_publisher_url},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this second event?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To catch the bug that this commit fixed: 7f93c42. It was failing because it doesn't work when there are multiple events found.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see!! Awesome! Thanks!

@di
Copy link
Member Author

di commented Aug 13, 2024

Out of date and mostly resolved by #16205 (@facutuesca, you might want to see if there's anything else we can use from this).

@di di closed this Aug 13, 2024
@facutuesca
Copy link
Contributor

Out of date and mostly resolved by #16205 (@facutuesca, you might want to see if there's anything else we can use from this).

I see that here the extra field is added to the file upload events.

While the additional field being added is the same (base_publisher_url here vs publisher_base_url in #16205), the difference is that this PR stored that field in the events, and then those events were used to verify URLs on-demand.

Since we are now verifying URLs at the time of the file upload (and storing the verified: bool in the DB), I don't think we need to store the field in the events, WDYT @di ?

@di
Copy link
Member Author

di commented Aug 13, 2024

Agreed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants