Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Support dist packages? #9

Closed
mpdude opened this issue Dec 29, 2019 · 13 comments
Closed

Support dist packages? #9

mpdude opened this issue Dec 29, 2019 · 13 comments

Comments

@mpdude
Copy link

mpdude commented Dec 29, 2019

I understand the decision to support only source packages in the first version of this plugin, because the necessary validation comes built into git.

It is, however, a limitation that might prevent people from using this plugin.

So, what would be needed to support dist as well, and can we get there without changes to Composer and/or Packagist?

Obviously, we need to figure out where to obtain GPG signatures for the individual packages, matching the versions installed.

Would it make sense from the security point of view if packages could put into their composer.json some extra metadata to point to an URL where the signature can be found? Maybe we could support simple placeholders in these URLs for the version number assigned to a package.

I haven’t yet checked if such extra data would easily be available for a plug-in. If all else fails, we could first download and unzip dist archives and then peek into composer.json ourselves.

Once we have the signature, use it to verify the ZIP (which has already been unpacked) and bail out if validation fails.

Too naive?

@Ocramius
Copy link
Member

Ocramius commented Dec 29, 2019 via email

@mpdude
Copy link
Author

mpdude commented Dec 29, 2019

I do understand your priorities.

It's not a question of doing it or not: it is simply not feasible. Uunless a signature (checksum+GPG signature) is exported with the published package, we can't do much about it.

Obviously the signature cannot be part of the package itself. But wouldn’t an URL as part of package metadata work? That would leave it to package authors how to distribute “their” signatures. They could, for example, attach them to GitHub releases.

@Ocramius
Copy link
Member

Ocramius commented Dec 29, 2019 via email

@mpdude
Copy link
Author

mpdude commented Dec 30, 2019

What if... we could convince GitHub to provide checksums and signatures at known (inferrable) locations with a dedicated key under their control exactly and only for those releases that they have verified to be signed by one of the repo maintainers?

Like with Symfony, releases are GPG-signed by Fabien and GitHub shows that info. If I'd trust that dedicated GH key, I could verify all dist ZIPs for Fabien's releases, without further work required for him. 🤔

People would not have to create dedicated releases and/or attach signature files. Only GPG sign their tags and make sure GH knows their key.

@Ocramius
Copy link
Member

Ocramius commented Dec 30, 2019 via email

@mpdude
Copy link
Author

mpdude commented Dec 30, 2019

Hm, maybe my explanation was not clear or I don't get you...

GH creates/provides ZIPs/tar.gzs for tagged commits. They can also check if those tags have been signed by someone with access to the repo.

Now they could have a key that belongs to them (they created it) to sign that the ZIP file is "authentic" (was created by them) and is based on a signed tag that they have verified... does that make sense?

@Ocramius
Copy link
Member

That doesn't really mean anything, since GitHub is a platform, and the original signature is not being checked anymore.

You have to do e2e authentication, GitHub is still a middle-man

@staabm
Copy link

staabm commented Dec 30, 2019

But still it would cover a lot (And it could work for most packages as a huge margin is hosted on github).. not perfect but way better than anything we have atm...?

@mpdude
Copy link
Author

mpdude commented Dec 30, 2019

Could go wrong if Mallory breaks into Alice's GitHub account, registers his GPG key with it, uses it to sign a malicious commit and publishes a release. Nobody could tell by looking at the ZIP signature issued by GitHub.

@staabm
Copy link

staabm commented Dec 30, 2019

Same thing when mallory steals the private key of alice and signs releases with it (github accounts at least can have 2fa-auth)

@Ocramius
Copy link
Member

The idea of e2e authentication and the trust chain is that the key can then be revoked.

What must be clear (before discussing further) is that GitHub is only a relay of the sources: it doesn't have any authentication that we can rely upon. Authentication comes from the source of the code. It is not possible to trust a signature made by GitHub on top of a released package if that package doesn't serve its own (author's) signature too.

@Ocramius
Copy link
Member

Closing here meanwhile: this is not feasible with current tech, and would require the tool to be much more popular and ergonomic (with --prefer-source) before being proposed again. Refer to composer/composer#4022 (comment), where @paragonie-security has described this in much more detail.

@mpdude
Copy link
Author

mpdude commented Jan 2, 2020

Just to put another idea on record: If we need an easily-available channel for package signatures to be distributed, maybe a signatures file (or .signatures directory) at the root of the master branch might do. That's not available per se if we download a dist archive for, let's say, some maintenance or release branch. But Packagist might find it and provide the URL/an endpoint to access the signature. Also, raw.githubusercontent.com might do the trick.

The point is that we need to find a way to teach people to acutally do the signing, take really good care of their keys and get the rest of the hassle out of the way. IMO, composer is so successful also because

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

No branches or pull requests

3 participants