Skip to content

Commit 82dcb50

Browse files
author
Jussi Kukkonen
committed
ngclient TrustedMetadataSet: Improve docstrings
Signed-off-by: Jussi Kukkonen <[email protected]>
1 parent 4811e88 commit 82dcb50

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

tuf/ngclient/_internal/trusted_metadata_set.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,21 @@
33

44
"""Trusted collection of client-side TUF Metadata
55
6-
TrustedMetadataSet keeps track of current valid set of metadata for the client,
7-
and handles almost every step of the "Detailed client workflow" (
6+
TrustedMetadataSet keeps track of the current valid set of metadata for the
7+
client, and handles almost every step of the "Detailed client workflow" (
88
https://theupdateframework.github.io/specification/latest#detailed-client-workflow)
99
in the TUF specification: the remaining steps are related to filesystem and
10-
network IO which is not handled here.
10+
network IO, which are not handled here.
1111
12-
Loaded metadata can be accessed via the index access with rolename as key
13-
(trusted_set["root"]) or, in the case of top-level metadata using the helper
12+
Loaded metadata can be accessed via index access with rolename as key
13+
(trusted_set["root"]) or, in the case of top-level metadata, using the helper
1414
properties (trusted_set.root).
1515
1616
The rules for top-level metadata are
17-
* Metadata is loadable only if metadata it depends on is loaded
18-
* Metadata is immutable if any metadata depending on it has been loaded
19-
* Metadata must be loaded/updated in order:
20-
root -> timestamp -> snapshot -> targets -> (other delegated targets)
21-
17+
* Metadata is updatable only if metadata it depends on is loaded
18+
* Metadata is not updatable if any metadata depending on it has been loaded
19+
* Metadata must be updated in order:
20+
root -> timestamp -> snapshot -> targets -> (delegated targets)
2221
2322
Exceptions are raised if metadata fails to load in any way.
2423
@@ -240,10 +239,10 @@ def root_update_finished(self):
240239
if self.root.signed.is_expired(self.reference_time):
241240
raise exceptions.ExpiredMetadataError("New root.json is expired")
242241

243-
# No need to recover from fast-forward attack here since
244-
# timestamp and snapshot are not loaded at this point and
245-
# when loaded later will be verified with the new rotated
246-
# keys.
242+
# No need to delete timestamp/snapshot here as specification instructs
243+
# for fast-forward attack recovery: timestamp/snapshot can not be
244+
# loaded at this point and when loaded later they will be verified
245+
# with current root keys.
247246

248247
self._root_update_finished = True
249248
logger.debug("Verified final root.json")

0 commit comments

Comments
 (0)