-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
attestation: add initial attestation helpers, integrate into brew install
#17049
Conversation
Adds the basic attestation verification APIs, as well as a pre-pour check against `HOMEBREW_VERIFY_ATTESTATIONS` that verifies the attestation (or backfill as necessary) for bottles from homebrew-core. Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
brew install
NB: I haven't written any tests yet; I want to get some eyes on this and then I'll do so once the general approach seems fine 🙂 |
Looks good. Probably don't any of the shell handling when we can just do: gh = with_env("HOMEBREW_VERIFY_ATTESTATIONS" => nil) do
ensure_executable!("gh")
end |
I was wracking my brain trying to remember |
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.
Looking good so far, nice work @woodruffw!
Co-authored-by: Mike McQuaid <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Good for another look! I've ratcheted down the typing + removed all of the invasive |
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.
Approach looks good to me! Some unit tests of Library/Homebrew/attestation.rb
would be sufficient for this to get merged.
Sounds good, doing today! |
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
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.
Looking good! Would be good to cover a couple more of the missing lines.
Signed-off-by: William Woodruff <[email protected]>
The coverage should be much better now, but this has revealed a logic error we made during the backfill: the
Edit: I thought about this a bit more, and there's a sound way to handle this different: the prepended hash is |
Signed-off-by: William Woodruff <[email protected]>
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.
One remaining question and then I'm ✅. Coverage is sufficient, just curious about the new method having supposedly missing coverage.
@@ -423,6 +423,11 @@ def tab_attributes | |||
github_packages_manifest_resource_tab(github_packages_manifest_resource) | |||
end | |||
|
|||
sig { returns(Filename) } | |||
def filename | |||
Filename.create(resource.owner, @tag, @spec.rebuild) |
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.
Seems weird no tests cover this, is this used anywhere right now?
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.
The tests currently use a double for it, so I think that's what it doesn't get coverage. Want me to add some separate coverage for it?
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.
Yeh or just double lower in the stack (the owner/tag/rebuild) so it still gets called?
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.
Done with 1607d04 -- I went with a separate test since the more invasive double was going to require a lot of nesting that would make the other tests harder to read, but I can shoehorn it in if that's your preference 🙂
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 also had to move the BottleSpecification
specs to their own file, since RuboCop was complaining about having two RSpec
stanzas in bottle_spec.rb
.)
Signed-off-by: William Woodruff <[email protected]>
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.
Thanks again @woodruffw!
Adds the basic attestation verification APIs, as well as a pre-pour check against
HOMEBREW_VERIFY_ATTESTATIONS
that verifies the attestation (or backfill as necessary) for bottles from homebrew-core.See #17019.
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?