mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Re-generate metadata to adopt spec version format change, using
`generate.py` plus some working around (see script below):
```
# QUICKFIX: Patch add_target to pass file paths relative to targets dir
git apply - <<EOF
diff --git a/tests/repository_data/generate.py b/tests/repository_data/generate.py
index 6c263575..699ed00f 100755
--- a/tests/repository_data/generate.py
+++ b/tests/repository_data/generate.py
@@ -119,12 +119,11 @@ if not options.dry_run:
# about the target (i.e., file permissions in octal format.)
octal_file_permissions = oct(os.stat(target1_filepath).st_mode)[4:]
file_permissions = {'file_permissions': octal_file_permissions}
-repository.targets.add_target(target1_filepath, file_permissions)
-repository.targets.add_target(target2_filepath)
+repository.targets.add_target('file1.txt', file_permissions)
+repository.targets.add_target('file2.txt')
-repository.targets.delegate('role1', [delegation_public],
- [os.path.basename(target3_filepath)])
-repository.targets('role1').add_target(target3_filepath)
+repository.targets.delegate('role1', [delegation_public], ['file3.txt'])
+repository.targets('role1').add_target('file3.txt')
repository.targets('role1').load_signing_key(delegation_private)
repository.targets('role1').delegate('role2', [delegation_public], [])
EOF
# Remove repository and client data
cd repository_data && rm -rf repository client
# Generate metadata
python generate.py
# Duplicate metadata files
cp -r client/test_repository1 client/test_repository2
# Recover non-signed file
git checkout client/map.json
```
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
61 lines
No EOL
1.6 KiB
JSON
61 lines
No EOL
1.6 KiB
JSON
{
|
|
"signatures": [
|
|
{
|
|
"keyid": "65171251a9aff5a8b3143a813481cb07f6e0de4eb197c767837fe4491b739093",
|
|
"sig": "d65f8db0c1a8f0976552b9742bbb393f24a5fa5eaf145c37aee047236c79dd0b83cfbb8b49fa7803689dfe0031dcf22c4d006b593acac07d69093b9b81722c08"
|
|
}
|
|
],
|
|
"signed": {
|
|
"_type": "targets",
|
|
"delegations": {
|
|
"keys": {
|
|
"c8022fa1e9b9cb239a6b362bbdffa9649e61ad2cb699d2e4bc4fdf7930a0e64a": {
|
|
"keyid_hash_algorithms": [
|
|
"sha256",
|
|
"sha512"
|
|
],
|
|
"keytype": "ed25519",
|
|
"keyval": {
|
|
"public": "fcf224e55fa226056adf113ef1eb3d55e308b75b321c8c8316999d8c4fd9e0d9"
|
|
},
|
|
"scheme": "ed25519"
|
|
}
|
|
},
|
|
"roles": [
|
|
{
|
|
"keyids": [
|
|
"c8022fa1e9b9cb239a6b362bbdffa9649e61ad2cb699d2e4bc4fdf7930a0e64a"
|
|
],
|
|
"name": "role1",
|
|
"paths": [
|
|
"file3.txt"
|
|
],
|
|
"terminating": false,
|
|
"threshold": 1
|
|
}
|
|
]
|
|
},
|
|
"expires": "2030-01-01T00:00:00Z",
|
|
"spec_version": "1.0.0",
|
|
"targets": {
|
|
"file1.txt": {
|
|
"custom": {
|
|
"file_permissions": "0644"
|
|
},
|
|
"hashes": {
|
|
"sha256": "65b8c67f51c993d898250f40aa57a317d854900b3a04895464313e48785440da",
|
|
"sha512": "467430a68afae8e9f9c0771ea5d78bf0b3a0d79a2d3d3b40c69fde4dd42c461448aef76fcef4f5284931a1ffd0ac096d138ba3a0d6ca83fa8d7285a47a296f77"
|
|
},
|
|
"length": 31
|
|
},
|
|
"file2.txt": {
|
|
"hashes": {
|
|
"sha256": "452ce8308500d83ef44248d8e6062359211992fd837ea9e370e561efb1a4ca99",
|
|
"sha512": "052b49a21e03606b28942db69aa597530fe52d47ee3d748ba65afcd14b857738e36bc1714c4f4adde46c3e683548552fe5c96722e0e0da3acd9050c2524902d8"
|
|
},
|
|
"length": 39
|
|
}
|
|
},
|
|
"version": 1
|
|
}
|
|
} |