Skip to content

Commit 83ac7be

Browse files
committed
client: new root sigs only counted once per keyid
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 #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>
1 parent 71cb004 commit 83ac7be

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tuf/client/updater.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ def _verify_root_self_signed(self, signable):
13851385
signatures = signable['signatures']
13861386
signed = securesystemslib.formats.encode_canonical(
13871387
signable['signed']).encode('utf-8')
1388-
validated = 0
1388+
verified_sig_keyids = set()
13891389

13901390
for signature in signatures:
13911391
keyid = signature['keyid']
@@ -1403,9 +1403,9 @@ def _verify_root_self_signed(self, signable):
14031403
valid_sig = securesystemslib.keys.verify_signature(key, signature, signed)
14041404

14051405
if valid_sig:
1406-
validated = validated + 1
1406+
verified_sig_keyids.add(keyid)
14071407

1408-
if validated >= threshold:
1408+
if len(verified_sig_keyids) >= threshold:
14091409
return True
14101410
return False
14111411

0 commit comments

Comments
 (0)