Skip to content

[WIP] Activate GPG verification upon install #16090

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 18 commits into from
Closed

[WIP] Activate GPG verification upon install #16090

wants to merge 18 commits into from

Conversation

jawshooah
Copy link
Contributor

Picking up where @ndr-qef left off with #8749.

This is still a work-in-progress, so please feel free to throw your feedback at me.

@jawshooah jawshooah added enhancement core Issue with Homebrew itself rather than with a specific cask. labels Dec 24, 2015
@fanquake
Copy link
Contributor

Nice work. Glad this is getting some love again.

@tapeinosyne
Copy link

Thanks for taking up the patchset, @jawshooah.

Beyond refactoring, it might be best to improve the CLI output —that is, hide the rather verbose one of GPG— in this PR, rather than postponing UX changes to a later date.

@adidalal
Copy link
Contributor

A (rather simple) idea would just be to dump the output to dev/null altogether (unless the --verbose flag is used) and have a single line, similar to the shasum check, i.e. "GPG verification of Cask succeded/failed"

@tapeinosyne
Copy link

Even simpler would be to set :print_stdout => false when invoking system gpg with our system_command wrapper.

@jawshooah
Copy link
Contributor Author

@ndr-qef I'm not very familiar with GPG, but should we be using gnupg2 instead of gnupg? Is the legacy version still supported?

@jawshooah
Copy link
Contributor Author

Also should we just add depends_on :formula => 'gpg' to casks with a gpg stanza?

@adidalal
Copy link
Contributor

I don't like adding that dependency to Casks, as gpg verification should be "best effort" - the notification that gpg verification was skipped (and to install gpg to activate it) should be enough

@tapeinosyne
Copy link

should we be using gnupg2 instead of gnupg? Is the legacy version still supported?

GnuPG 1 is stable and maintained, as well as widely deployed — notably in the Debian package manager, where it is the standard version to this day.

In any case, the gpg command is meant to call the standard system GPG, whichever that may be. (Much like git, ruby, and so on.) As it happens, many OS X users install GPG through GPGTools, which ships version 2.

@jawshooah
Copy link
Contributor Author

Gotcha. Just wanted to make sure we weren't dating ourselves. I'll work on this more tonight.

@dconnolly
Copy link
Contributor

What's the plan for getting this merged? I'm looking forward to checking signatures without local patches on top.

@jawshooah
Copy link
Contributor Author

There's still a bit more work to be done before merging. I've been swamped for a while, but I'll try to get this out within the next few days.

@dconnolly
Copy link
Contributor

Awesome, thank you!

@fanquake
Copy link
Contributor

fanquake commented Mar 5, 2016

@jawshooah Any update on this?

@fanquake
Copy link
Contributor

fanquake commented May 10, 2016

@jawshooah ping

@jawshooah
Copy link
Contributor Author

Sorry for the huge delay on this. Life has been dropping a hammer on me the last few months. I should have some time this evening to work on this, though.

@fanquake fanquake added the awaiting maintainer feedback Issue needs response from a maintainer. label Jun 3, 2016
@fanquake
Copy link
Contributor

@caskroom/maintainers Does anyone want to give any feedback here?

@vitorgalvao
Copy link
Contributor

Hadn’t noticed there were commits after the last comment. Is this ready @jawshooah?

@jawshooah
Copy link
Contributor Author

jawshooah commented Jun 15, 2016

Should be functional, I've just been meaning to add more tests but haven't gotten around to it. Also needs a rebase.


def initialize(cask, downloaded_path, command=Hbc::SystemCommand)
def initialize(cask, downloaded_path, force_fetch=false, command=Hbc::SystemCommand)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should change the force_fetch and command parameters inside the signature into an options hash. Options hashes clean up signatures and result in code that is easier to read.

That way, we would also stay consistent to existing, similar initializers (example 1 2 3).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we now assume users are running Ruby >=2.0, why not use keyword arguments?

Copy link
Contributor

Choose a reason for hiding this comment

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

@jawshooah Thanks for pointing that out. Those would be an even better choice!

@claui
Copy link
Contributor

claui commented Jun 16, 2016

One more issue that needs to be discussed before we merge is error handling.

For example, as of right now

https://get.videolan.org/vlc/2.2.4/macosx/vlc-2.2.4.dmg

is up, while at the same time

https://get.videolan.org/vlc/2.2.4/macosx/vlc-2.2.4.dmg.asc

returns a HTTP 500 status:

We're very sorry but...
none of our mirrors are able to handle your request, please try again later

When I rebase this PR and then do brew cask install vlc, the following happens:

image

I think it’s perfectly acceptable for the whole installation to fail when the signature is unavailable. However, this should result in a clear error message indicating what happened, rather than just bailing out with a stack trace.

@fanquake
Copy link
Contributor

fanquake commented Jul 3, 2016

This needs a rebase.

@fanquake
Copy link
Contributor

fanquake commented Aug 8, 2016

ping @jawshooah Any chance you could rebase and update the error handling?

@jawshooah
Copy link
Contributor Author

@fanquake Hopefully I can get to this later tonight.

@fanquake fanquake changed the title Activate GPG verification upon install (rebased) Activate GPG verification upon install Aug 10, 2016
@jawshooah jawshooah changed the title Activate GPG verification upon install [WIP] Activate GPG verification upon install Aug 12, 2016
@jawshooah
Copy link
Contributor Author

Leaving this open since there is still interest, I just haven't gotten around to cleaning it up yet. Will try to migrate to Homebrew/brew later this evening.

@jawshooah jawshooah removed the awaiting maintainer feedback Issue needs response from a maintainer. label Oct 20, 2016
@jawshooah
Copy link
Contributor Author

Continued in Homebrew/brew#1335.

@jawshooah jawshooah closed this Oct 20, 2016
@jawshooah jawshooah deleted the gpg branch October 20, 2016 05:25
@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