Skip to content

Commit 44d48af

Browse files
committed
fixup! client: new root sigs only counted once per keyid
1 parent ab30113 commit 44d48af

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

tuf/client/updater.py

Lines changed: 3 additions & 6 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-
verified_sig_keyids = []
1388+
verified_sig_keyids = set()
13891389

13901390
for signature in signatures:
13911391
keyid = signature['keyid']
@@ -1403,12 +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-
verified_sig_keyids.append(keyid)
1406+
verified_sig_keyids.add(keyid)
14071407

1408-
# A signature with a given keyid should only count towards the threshold
1409-
# once. Convert the list of keyids into a set, in order to uniquify them
1410-
# and therefore count each keyid only once towards the threshold.
1411-
if len(set(verified_sig_keyids)) >= threshold:
1408+
if len(verified_sig_keyids) >= threshold:
14121409
return True
14131410
return False
14141411

0 commit comments

Comments
 (0)