Skip to content

Commit faf80ac

Browse files
ericktlukpueh
authored andcommitted
Remove root, add delegation hashes to the snapshot metadata
According to @JustinCappos in #31, the root.json is no longer needed in the snapshot metadata, because the workflow will already have updated the root metadata before the snapshot metadata is fetched. In addition, section 5.6 of the Mercury paper describes a need for delegations to contain hashes in order to protect against malicous mirrors that may substitute one version of the delegated metadata with another. This cannot be detected without hashing of these files. Closes #31
1 parent e4eea45 commit faf80ac

File tree

1 file changed

+46
-31
lines changed

1 file changed

+46
-31
lines changed

tuf-spec.md

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -710,10 +710,10 @@ repo](https://github.com/theupdateframework/specification/issues).
710710

711711
* **4.4. File formats: snapshot.json**
712712

713-
The snapshot.json file is signed by the snapshot role. It lists the version
714-
numbers of all metadata on the repository, excluding timestamp.json and
715-
mirrors.json. For the root role, the hash(es), size, and version number
716-
are listed.
713+
The snapshot.json file is signed by the snapshot role. It lists the version
714+
numbers, and optionally the size, of all metadata on the repository,
715+
excluding root.json, timestamp.json and mirrors.json. For delegated roles,
716+
the hash(es) are also listed.
717717

718718
The "signed" portion of snapshot.json is as follows:
719719

@@ -727,43 +727,58 @@ repo](https://github.com/theupdateframework/specification/issues).
727727
METAFILES is an object whose format is the following:
728728

729729
{ METAPATH : {
730-
"version" : VERSION }
730+
"version" : VERSION,
731+
"length" : LENGTH,
732+
"hashes" : HASHES,
733+
("custom" : { ... }) }
731734
, ...
732735
}
733736

734737
METAPATH is the metadata file's path on the repository relative to the
735738
metadata base URL.
736739

737-
VERSION is listed for the root file
738-
and all other roles available on the repository.
740+
VERSION is listed for all roles available on the repository.
741+
742+
LENGTH is the optional integer length in bytes of the file. It is optional
743+
for all roles.
744+
745+
HASHES is a dictionary that specifies one or more hashes, including
746+
the cryptographic hash function. For example: { "sha256": HASH, ... }. It
747+
is required for delegated roles, and optional for all others.
739748

740749
A snapshot.json example file:
741750

742-
{
743-
"signatures": [
744-
{
745-
"keyid": "66676daa73bdfb4804b56070c8927ae491e2a6c2314f05b854dea94de8ff6bfc",
746-
"sig": "f7f03b13e3f4a78a23561419fc0dd741a637e49ee671251be9f8f3fceedfc112e4
747-
4ee3aaff2278fad9164ab039118d4dc53f22f94900dae9a147aa4d35dcfc0f"
748-
}
749-
],
750-
"signed": {
751-
"_type": "snapshot",
752-
"spec_version": "1.0.0",
753-
"expires": "2030-01-01T00:00:00Z",
754-
"meta": {
755-
"root.json": {
756-
"version": 1
757-
},
758-
"targets.json": {
759-
"version": 1
760-
},
761-
"project.json": {
762-
"version": 1
763-
},
751+
{ "signatures": [
752+
{
753+
"keyid": "66676daa73bdfb4804b56070c8927ae491e2a6c2314f05b854dea94de8ff6bfc",
754+
"sig": "f7f03b13e3f4a78a23561419fc0dd741a637e49ee671251be9f8f3fceedfc112e4
755+
4ee3aaff2278fad9164ab039118d4dc53f22f94900dae9a147aa4d35dcfc0f"
764756
}
765-
"version": 1
766-
},
757+
],
758+
"signed": {
759+
"_type": "snapshot",
760+
"spec_version": "1.0.0",
761+
"expires": "2030-01-01T00:00:00Z",
762+
"meta": {
763+
"targets.json": {
764+
"version": 1
765+
},
766+
"project1.json": {
767+
"version": 1,
768+
"hashes": {
769+
"sha256": "f592d072e1193688a686267e8e10d7257b4ebfcf28133350dae88362d82a0c8a"
770+
}
771+
},
772+
"project2.json": {
773+
"version": 1,
774+
"length": 604,
775+
"hashes": {
776+
"sha256": "1f812e378264c3085bb69ec5f6663ed21e5882bbece3c3f8a0e8479f205ffb91"
777+
}
778+
}
779+
},
780+
"version": 1
781+
}
767782
}
768783

769784
* **4.5. File formats: targets.json and delegated target roles**

0 commit comments

Comments
 (0)