-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trigger rollback check even without local snapshot
If you do the following steps: 1. local root is loaded, root is updated until final 2. local timestamp is loaded 3. timestamp is updated (meta (version, hashes, length) for snapshot changes here) 4. local snapshot is loaded (hashes and length do not match the data in timestamp, preventing loading) remote snapshot is loaded 5. remote snapshot is loaded then when executing step 5 the rollback checks will not be done because the old snapshot was not loaded. Similar issues for version numbers and expiry are being fixed by delaying the checks until we know we have the "final" snapshot. We don't want to do the exact same thing here as the hashes are meant to prevent even parsing data we don't trust... This seems to be a case where "trusted local metadata" and "untrusted data from the network" is the deciding factor. TrustedMetadataSet does not have this information currently so possibly the best solution is to add a new argument "trusted" to update_snapshot. Even though this is ugly as the rest of the update functions doesn't have such an argument, it seems the best solution as it seems to work in all cases: - when loading a local snapshot, we know the data has at some point been trusted (signatures have been checked): it doesn't need to match hashes now - if there is no local snapshot and we're updating from remote, the remote data must match meta hashes in timestamp - f there is a local snapshot and we're updating from remote, the remote data must match meta hashes in timestamp Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
- Loading branch information
Showing
3 changed files
with
45 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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