Skip to content
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

Cache bottle attestations #18581

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Cache bottle attestations #18581

wants to merge 2 commits into from

Conversation

carlocab
Copy link
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

This will help limit the number of times we need to query GitHub for the
attestation in CI.

This will help limit the number of times we need to query GitHub for the
attestation in CI.
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Makes sense to me! Does make me wonder whether this caching could/should be in Homebrew/brew, though?

@carlocab
Copy link
Member Author

Does make me wonder whether this caching could/should be in Homebrew/brew, though?

That's where we're making this change!

@MikeMcQuaid
Copy link
Member

That's where we're making this change!

I cannot read today 🙈 apologies!

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Confirmed this still looks good now I know what repository I'm in today 🙃


sig { params(pathname: Pathname, scrub: T::Boolean).returns(T::Boolean) }
def stale_attestation?(pathname, scrub)
scrub || prune?(pathname, ATTESTATION_CLEANUP_DAYS)
Copy link
Member

Choose a reason for hiding this comment

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

Might be nice if this could be cleaned up based on the state of the cached bottles? Not a blocker, very much nice-to-have.


if cached_attestation.exist?
begin
return JSON.parse(cached_attestation.read)
Copy link
Member

Choose a reason for hiding this comment

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

Just to make sure I understand: the intended behavior here is to treat a cached attestation as implicitly previously verified, right?

I think we could go two ways with this: either assume cached == verified (which in turn means an attacker who can modify the cache/insert a dummy cache member can bypass verification, although such an attacker is already pretty powerful), or perform verification again on the cached attestation (so skip the download, but do the rest of the gh attestation verify).

The first seems fine to me, but the second is perhaps preferable.

Copy link
Member

Choose a reason for hiding this comment

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

The first seems fine to me, but the second is perhaps preferable.

Agreed 👍🏻

Copy link

github-actions bot commented Nov 8, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Nov 8, 2024
@woodruffw woodruffw added in progress Maintainers are working on this and removed stale No recent activity labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Maintainers are working on this
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants