Fix root self verification to only count a keyid once towards the threshold#1218
Merged
lukpueh merged 2 commits intoNov 24, 2020
Merged
Conversation
trishankatdatadog
suggested changes
Nov 23, 2020
jku
reviewed
Nov 23, 2020
jku
approved these changes
Nov 24, 2020
lukpueh
approved these changes
Nov 24, 2020
lukpueh
left a comment
Member
There was a problem hiding this comment.
Thanks for the quick fix and the test, @joshuagl! Please add DCO and we are good to go.
Also, kudos to @trishankatdatadog, for bringing this to our attention.
When the updater is verifying that the new root metadata is signed by a threshold of keys defined by the new root metadata itself, multiple signatures with the same keyid should not be counted more than once towards the threshold. Implement a test for this, which currently fails. Reported-by: Trishank Karthik Kuppusamy <trishank.kuppusamy@datadoghq.com> Signed-off-by: Joshua Lock <jlock@vmware.com>
When verifying newly downloaded root metadata with the keys listed in the root metadata being verified, multiple signatures with the same keyid should not be counted towards the threshold. A keyid should only count once towards the threshold. This fixes the _verify_root_self_signed() method introduced in PR theupdateframework#1101 to ensure that keyids are only counted once when verifying a threshold of new root signatures. Signed-off-by: Joshua Lock <jlock@vmware.com>
44d48af to
83ac7be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #N/A
Description of the changes being introduced by the pull request:
@trishankatdatadog perceptively observed that
_verify_root_self_signed(), introduced in #1101, will incorrectly count multiple signatures with the same keyid towards the threshold for new signatures listed inside an updated root metadata file.This PR introduces:
_verify_root_self_signed()to uniquify a list of keyids for which signatures have been verified, and compare only the number of unique keyids against the threshold.Please verify and check that the pull request fulfills the following
requirements: