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

Activate GPG verification upon install #8749

Closed
wants to merge 11 commits into from
Closed

Activate GPG verification upon install #8749

wants to merge 11 commits into from

Conversation

tapeinosyne
Copy link
Contributor

Refer to #5971.

This patchset lands GPG verification as a working feature, with a minimum of tests. GPG verification is automatically enabled if a working gpg binary is found on the system.

Most notably, two decisions are open for debate.

Failure handling

Handling of failed GPG verification is delegated from the Hbc::GpgCheck class to the caller. (As of this PR, the only caller is intended to be Hbc::Verify.gpg_signature.)

This is largely a matter of internal design, with no functional consequences.

CLI output

Standard gpg output is printed unmodified. Security features may benefit from a transparent UI, but I worry that the galore of lines and information is noise to most users, or otherwise irrelevant.

As an example, consider the output of brew cask install libre-office, sans our own GPG messages:

==> Downloading https://download.documentfoundation.org/libreoffice/stable/4.3.5
######################################################################## 100.0%
######################################################################## 100.0%
==> gpg: requesting key AFEEAEA3 from hkps server hkps.pool.sks-keyservers.net
==> gpg: key AFEEAEA3: "LibreOffice Build Team (CODE SIGNING KEY) <build@documen
==> gpg: Total number processed: 1
==> gpg:              unchanged: 1
==> gpg: Signature made Fri Dec 12 17:52:48 2014 GMT using RSA key ID AFEEAEA3
==> gpg: Good signature from "LibreOffice Build Team (CODE SIGNING KEY) <build@d
==> gpg: WARNING: This key is not certified with a trusted signature!
==> gpg:          There is no indication that the signature belongs to the owner
==> Primary key fingerprint: C283 9ECA D940 8FBE 9531  C3E9 F434 A1EF AFEE AEA3
==> Symlinking App 'LibreOffice.app' to '/Applications/LibreOffice.app'

(For the purpose of this discussion, ignore truncation as an unrelated issue.)

It is arguably desirable to silence gpg commands, as commonly done by other package managers, and favor more concise notifications for each step: key retrieval, signature download, and final check.

ndr added 2 commits January 25, 2015 06:10
and store the result in a field instead. Failure handling is delegated.
@tapeinosyne tapeinosyne added the core Issue with Homebrew itself rather than with a specific cask. label Jan 25, 2015
@tapeinosyne
Copy link
Contributor Author

I would like to move forward and address the issue of user-facing UX separately.

@phinze, this PR is tangled with parts of the codebase you may not be too familiar with (e.g. metadata), but perhaps you would like to review it anyway? Some segments could likely be clarified.

@phinze
Copy link
Contributor

phinze commented Jan 25, 2015

This is great, @ndr-qef! I might suggest some rearrangement of the methods in GpgCheck but it's just minor stylistic stuff that we can figure out after this lands.

Re: output - I think I fall on the side of making the output cleaner and maybe just outputting the fingerprint with an OK. But similarly I think that's something we can iterate on after this feature lands.

I'm really happy to see this security-focused stuff moving forward - it's something I've wanted to do in the project for a long time. 🎉 🔐

@tapeinosyne
Copy link
Contributor Author

I might suggest some rearrangement of the methods in GpgCheck but it's just minor stylistic stuff that we can figure out after this lands.

Oh, there is no particular urgency to merge; my intention is to bring the core functionality to a working state, largely free from further tinkering. If you already have specific advice, I would welcome it.

ndr added 9 commits January 27, 2015 09:34
Specifically, handle cases where the most recent metadata folder was
created by something other than GpgCheck, e.g. an `install --force`.
and require `gpg_check`, thereby introducing an entry point for GPG
verification.
and associated support files: test Casks, binaries, signature.

meta_dir = cached || @cask.metadata_subdir('gpg', :now, true)
sig_path = meta_dir.join("signature.asc")
sig_path = meta_dir.join('signature.asc')
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this assume the signature is always in the signature.asc file? This may not always be the case—and actually isn't for a lot of software. The creators may have a signature with a different name, or (as is most common) may have clearsigned the sha256 hashes of all the executables they serve for their project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, that is merely the path to our local copy of the signature.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, sorry for not researching better what that was :)

@vitorgalvao
Copy link
Member

@ndr-qef What is this waiting on?

@fanquake
Copy link
Contributor

I'd really like to see this merged, @vitorgalvao given that @ndr-qef has gone quiet recently, how would you like to move forward here?

@jawshooah
Copy link
Contributor

@fanquake I'm doing some refactoring that should make this easier to integrate (#16084). Once done, I'll rebase @ndr-qef's work and go from there.

@adidalal
Copy link
Contributor

adidalal commented Jan 3, 2016

Closing as #16090 builds off of this PR and thus includes the changes proposed here.

@adidalal adidalal closed this Jan 3, 2016
@miccal miccal removed core Issue with Homebrew itself rather than with a specific cask. enhancement labels Dec 23, 2016
@Homebrew Homebrew locked and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants