-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ng client: support for prefix_targets_with_hash
Add support for prefixing targets with their hashes when downloading or using HASH.FILENAME.EXT as target names. The introduction of prefix_targets_with_hash was necessary, because there are use cases like Warehouse where you could use consistent_snapshot, but without adding a hash prefix to your targets. When prefix_targets_with_hash is set to True, target files conforming the format HASH.FILENAME.EXT will be downloaded from the server, but they will be saved on the client side without their hash prefixes or FILENAME.EXT. This makes sure the client won't understand the usage of prefix_targets_with_hash. Still, if you want to use HASH.FILENAME.EXT as target names when downloading, then additionally you need to provide consistent_snapshot set to True in your root.json. The reason is that the specification uses consistent_snapshot for the same purpose: "If consistent snapshots are not used (see § 6.2 Consistent snapshots), then the filename used to download the target file is of the fixed form FILENAME.EXT (e.g., foobar.tar.gz). Otherwise, the filename is of the form HASH.FILENAME.EXT (e.g., c14aeb4ac9f4a8fc0d83d12482b9197452f6adf3eb710e3b1e2b79e8d14cb681.foobar.tar.gz), where HASH is one of the hashes of the targets file listed in the targets metadata file found earlier in step § 5.6 Update the targets role. In either case, the client MUST write the file to non-volatile storage as FILENAME.EXT." The same behavior of using two flags is used in the legacy code when calling tuf.client.updater.download_target() in a repository using prefix_targets_with_hash and consistent_snapshot. See chapter 5.7.3: https://theupdateframework.github.io/specification/latest/index.html#fetch-target By default, prefix_targets_with_hash is set to true to make it easier to the user to provide uniquely identifiable targets file names by using consistent_snapshot set to True. Signed-off-by: Martin Vrachev <[email protected]>
- Loading branch information
Showing
3 changed files
with
102 additions
and
10 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