-
Notifications
You must be signed in to change notification settings - Fork 379
RFC: thinking out loud about signed-by field to accompany git: urls
#6702
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
base: master
Are you sure you want to change the base?
Conversation
url {
src: "git+https://<git-repo-url>#<hash-or-tag>"
signed-by: <public key here>
}
signed-by field to accompany git: urlssigned-by field to accompany git: urls
|
pinging @kit-ty-kate who has discussed some of this before and @hannesm who has thought about package signing in the context of opam-repo |
|
I'm unfamiliar with the invariants brought by git signing (e.g. how does this check the final content, is the check redundant, what algorithms are used, …) so i'll leave that to @hannesm who probably knows better. Adding this to be used in opam-repository at scale, bring a lot of new issues. Here's what i could think of so far:
|
Also i don't think opam should allow tags in signed-by mode as it breaks the reproducibility principle (the author can, maliciously or not, force-push the tag to something completely different, as far as i understand signing doesn't protect against that at all). Hashes can be fine though, iff the algorithms used are sound. |
|
Thanks for the answer! re: tags breaking the reproducibility: Wouldn't the checksum check take care of detecting changes? Actually thinking about it: what does the checksum do for git urls? should it check the commit hash? Gonna look into this a bit. re: storing and caching (but actually it also relates to checking reproducibility): I think we can work something because we can go from commit object to tree hash, from tree hash to tree (via
|
|
What a nice idea. But what is the gain and what are the failure semantics? So we have a package A that is signed with some key at a commit C. How should an update to C+n work? What should happen (inside opam?) if the signature verification fails? Last time I looked, the signature data is our of the git tree and thus a malicious server (or person in the middle) could strip the signature off. And what about opam files with released packages, where we have the tarballs? And will the code for signature verification be part of opam? Or done differently? I guess with this and conex we can verify pins (so something ponned to a git repository) and releases at the same time, which sounds great. But another thing is, for conex and the threat models, it is crucial that the metadata (the opam file) itself is signed - since there's the set of dependencies (so nobody injects you some other dependency).... I guess with this proposal here only the source code would be signed (which is already better than nothing, but maybe not enough). I suggest to read through https://theupdateframework.github.io/specification/latest/#goals-to-protect-against-specific-attacks to get an idea what are attack vectors (by no means this says we shouldn't do anything that doesn't cover all of them). |
I think the idea I had is that C+n would be a new release, necessiting a new package description file. So you'd have a file The advantage is that it makes it easy to know that both packages were published by the same author. (Assuming the author's key has not be stollen etc.) Two packages with the same "signed-by" field can only validly point to commits that have been signed by the same person (once again, assuming…). A nice future work is for opam to warn users when they update from a version to another and the signing key is different.
Signature verification failure should be treated like a checksum failure: don't even save the data in the local cache. The remote (or some intermediary) can remove the signature, but that's the same threat as the remote sending a tarball with different data than was published. Right? (I might be missing something.)
I don't understand the question. The idea is to be able to use either tarball-style publishing (as it currently exists) or commit-style publishing (new proposal). Packages can do either. But I'm not sure this answers your question.
It could be done by a separate tool that opam calls when it tries to download git urls with
Correct, it's only the source code that is signed.
Thanks, I'll have a look. |
This I guess is one of the really difficult bits and pieces: the public key infrastructure you want to establish. For your personal project this may be feasible (assuming you never lose your key) -- but for some organization publishing releases (or yourself losing your key), key rollover (so another key signs the next release) is crucial. It may be feasible with your proposed signed-by field to reference sigstore (https://www.sigstore.dev/)? If every key rollover triggers a warning in opam, I suspect you'll end up with lots of false positives and users/clients will ignore the warning -- so a compromise won't be detected. Also, it sounds computationally heavy that for each update you'll need to check all previous releases of that package to check whether the key id is the same. And the other issue is that the metadata (the opam file itself) is not signed -- i.e. an attacker with access to the repository can introduce arbitrary dependencies. |
The idea for this PR is to allow the URL field of opam files to include a
signed-byfield:The status is that it's not ready in any way but that the basic structure of the code is there. (You know, all that remains is the mere pesky little details of cryptography.)
This PR is meant more as a place to discuss primarily the basic idea of adding commit-signature verification into opam, and then secondarily the file format changes and the implementation and such…