Skip to content

Commit eab64ac

Browse files
committed
client: add comment to document a design choice
Add a comment documenting why we perform the root self verification in _verify_metadata_file Signed-off-by: Joshua Lock <[email protected]>
1 parent 6eaf194 commit eab64ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tuf/client/updater.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,6 +1490,12 @@ def _verify_metadata_file(self, metadata_file_object,
14901490
# For root metadata, verify the downloaded root metadata object with the
14911491
# new threshold of new signatures contained within the downloaded root
14921492
# metadata object
1493+
# NOTE: we perform the checks on root metadata here because this enables
1494+
# us to perform the check before the tempfile is persisted. Furthermore,
1495+
# by checking here we can easily perform the check for each download
1496+
# mirror. Whereas if we check after _verify_metadata_file we may be
1497+
# persisting invalid files and we cannot try copies of the file from other
1498+
# mirrors.
14931499
if valid and metadata_role == 'root':
14941500
valid = self._verify_root_self_signed(metadata_signable)
14951501
if not valid:

0 commit comments

Comments
 (0)