-
Notifications
You must be signed in to change notification settings - Fork 478
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
feat: add support for pgp signing (#2577) #2882
Conversation
Pinging @warthog9 -- does this look like the type of signing you'd expect to get as a mirror? |
@terriko @warthog9 here is the public key and a sample file for testing purposes
|
The contents looks right to me at first glance. The file extension should be .asc to follow RFC3156 section 9.2, not .sig. I don't think I need to worry about the data in the .json, from the mirroring perspective (mostly in the realm of it's outside my personal scope on this), but is the |
@warthog9 The |
Codecov Report
@@ Coverage Diff @@
## main #2882 +/- ##
==========================================
- Coverage 82.97% 81.66% -1.31%
==========================================
Files 694 694
Lines 10754 10881 +127
Branches 1430 1476 +46
==========================================
- Hits 8923 8886 -37
- Misses 1465 1612 +147
- Partials 366 383 +17
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 15 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@terriko requesting review, thanks! |
I think my thinking with respect to I wouldn't want to give a false sense of something with it being there vs. not myself, and if it was me I'd probably vote to drop it in favor of something like an attempt to fetch and checking the return code if the file is present, etc. |
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.
Okay, thinking about the behaviour I'd expect:
- if a .asc file exists, verify it. Halt everything if it fails, maybe after one or two wait-and-retry cycles in case the mirror just happened to be updating at that second.
- if no .asc exists, log a warning but continue.
- skip both these behaviours and don't download signatures or validate anything if you've passed in an
ignore-signature
option. - We might potentially also want a "permissive" mode, where it doesn't halt but any signature errors are logged prominently. I don't love this as an option but I can see an argument for "I'd rather have a partial scan and an error to tell me to re-run than nothing"
Adding signed:true
into the json would just make two other possible failure cases that would complicate the user's understanding of what's going on:
- json says it's signed but no .asc so things fail. I guess this could detect an attack where someone deleted the .asc file off the main mirror, but if they could delete those files why wouldn't they edit the json at the same time? Not what value this has in a reasonable threat model.
- json says it's not signed but there is a .asc which then isn't used. Do we log this and hope users notice? Try to validate the .asc file and log a different error if it doesn't match? Does this leave a hole for attackers to modify the json on a mirror even if they can't edit the .asc signature on the main source?
So, I'm not seeing a huge value to the json signed:true entry, and I'm seeing some downsides. Let's take the json signed entry out; we can reconsider it if there's a viable attack it would prevent later.
@terriko if no .asc file exists shouldn't it fail? and warn the user that the data is not signed and to ignore this error run it with |
Hm, you're right. Failing if there's no .asc is safer, but if it comes up a lot it increases the chances that people will turn off signatures entirely, which would then be less safe. So rethinking:
I guess start with 1 and 3, and use data to see if signature errors come up enough that we want the middle road option of 2. |
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.
More of a code review with an eye to getting rid of the signed: true
metadata option.
@terriko requesting review, thanks! |
Took a quick glance through and I think this is good enough that we can reasonably merge and iterate, but I think it deserves a more careful read-through than I can give it right now, so I'm going to flag it and try to come back later (likely tomorrow). |
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.
Okay, let's get this merged (finally!). And we'll see if we can get the mirrors doing something next.
part of #2577