Skip to content

Commit bf7b0f3

Browse files
ericktlukpueh
authored andcommitted
Add the section number to the application workflow.
The rest of the TUF spec refers to each part of the document as $SECTION.$STEP. This updates the application workflow to also include the section number. This disambiguates referring to "2.2" from either referring to the "Thread Model and Analysis" from checking for a timestamp rollback attack.
1 parent 2e7ec3a commit bf7b0f3

File tree

1 file changed

+69
-68
lines changed

1 file changed

+69
-68
lines changed

tuf-spec.md

Lines changed: 69 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,41 +1073,42 @@ repo](https://github.com/theupdateframework/specification/issues).
10731073
still be able to update again in the future. Errors raised during the update
10741074
process should not leave clients in an unrecoverable state.
10751075

1076-
**0**. **Load the trusted root metadata file.** We assume that a good, trusted
1077-
copy of this file was shipped with the package manager or software updater
1078-
using an out-of-band process. Note that the expiration of the trusted root
1079-
metadata file does not matter, because we will attempt to update it in the
1080-
next step.
1081-
1082-
**1**. **Update the root metadata file.**
1083-
Since it may now be signed using entirely different keys, the client MUST
1084-
somehow be able to establish a trusted line of continuity to the latest set
1085-
of keys (see Section 6.1). To do so, the client MUST download intermediate
1086-
root metadata files, until the latest available one is reached. Therefore, it
1087-
MUST temporarily turn on consistent snapshots in order to download
1088-
_versioned_ root metadata files as described next.
1089-
1090-
* **1.1**. Let N denote the version number of the trusted root metadata file.
1091-
1092-
* **1.2**. **Try downloading version N+1 of the root metadata file**, up to
1076+
**5.0**. **Load the trusted root metadata file.** We assume that a good,
1077+
trusted copy of this file was shipped with the package manager or software
1078+
updater using an out-of-band process. Note that the expiration of the
1079+
trusted root metadata file does not matter, because we will attempt to update
1080+
it in the next step.
1081+
1082+
**5.1**. **Update the root metadata file.** Since it may now be signed using
1083+
entirely different keys, the client MUST somehow be able to establish a
1084+
trusted line of continuity to the latest set of keys (see Section 6.1). To do
1085+
so, the client MUST download intermediate root metadata files, until the
1086+
latest available one is reached. Therefore, it MUST temporarily turn on
1087+
consistent snapshots in order to download _versioned_ root metadata files as
1088+
described next.
1089+
1090+
* **5.1.1**. Let N denote the version number of the trusted root metadata
1091+
file.
1092+
1093+
* **5.1.2**. **Try downloading version N+1 of the root metadata file**, up to
10931094
some W number of bytes (because the size is unknown). The value for W is set
10941095
by the authors of the application using TUF. For example, W may be tens of
10951096
kilobytes. The filename used to download the root metadata file is of the
10961097
fixed form VERSION_NUMBER.FILENAME.EXT (e.g., 42.root.json). If this file is
1097-
not available, or we have downloaded more than Y number of root metadata files
1098-
(because the exact number is as yet unknown), then go to step 1.8. The value
1099-
for Y is set by the authors of the application using TUF. For example, Y may
1100-
be 2^10.
1098+
not available, or we have downloaded more than Y number of root metadata
1099+
files (because the exact number is as yet unknown), then go to step 1.8. The
1100+
value for Y is set by the authors of the application using TUF. For example,
1101+
Y may be 2^10.
11011102

1102-
* **1.3. Check for an arbitrary software attack.** Version N+1 of the root
1103+
* **5.1.3. Check for an arbitrary software attack.** Version N+1 of the root
11031104
metadata file MUST have been signed by: (1) a threshold of keys specified in
11041105
the trusted root metadata file (version N), and (2) a threshold of keys
11051106
specified in the new root metadata file being validated (version N+1). If
11061107
version N+1 is not signed as required, discard it, abort the update cycle,
11071108
and report the signature failure. On the next update cycle, begin at step 0
11081109
and version N of the root metadata file.
11091110

1110-
* **1.4. Check for a rollback attack.** The version number of the trusted
1111+
* **5.1.4. Check for a rollback attack.** The version number of the trusted
11111112
root metadata file (version N) MUST be less than or equal to the version
11121113
number of the new root metadata file (version N+1). Effectively, this means
11131114
checking that the version number signed in the new root metadata file is
@@ -1116,71 +1117,71 @@ repo](https://github.com/theupdateframework/specification/issues).
11161117
rollback attack. On the next update cycle, begin at step 0 and version N of
11171118
the root metadata file.
11181119

1119-
* **1.5**. Note that the expiration of the new (intermediate) root metadata
1120-
file does not matter yet, because we will check for it in step 1.8.
1120+
* **5.1.5**. Note that the expiration of the new (intermediate) root metadata
1121+
file does not matter yet, because we will check for it in step 5.1.8.
11211122

1122-
* **1.6**. **Set the trusted root metadata file** to the new root metadata
1123+
* **5.1.6**. **Set the trusted root metadata file** to the new root metadata
11231124
file.
11241125

1125-
* **1.7**. **Persist root metadata.** The client MUST write the file to
1126+
* **5.1.7**. **Persist root metadata.** The client MUST write the file to
11261127
non-volatile storage as FILENAME.EXT (e.g. root.json).
11271128

1128-
* **1.8**. **Repeat steps 1.1 to 1.8**.
1129+
* **5.1.8**. **Repeat steps 5.1.1 to 5.1.8**.
11291130

1130-
* **1.9**. **Check for a freeze attack.** The latest known time MUST be
1131+
* **5.1.9**. **Check for a freeze attack.** The latest known time MUST be
11311132
lower than the expiration timestamp in the trusted root metadata file
11321133
(version N). If the trusted root metadata file has expired, abort the update
11331134
cycle, report the potential freeze attack. On the next update cycle, begin
11341135
at step 0 and version N of the root metadata file.
11351136

1136-
* **1.10**. **If the timestamp and / or snapshot keys have been rotated, then
1137-
delete the trusted timestamp and snapshot metadata files.** This is done in
1138-
order to recover from fast-forward attacks after the repository has been
1137+
* **5.1.10**. **If the timestamp and / or snapshot keys have been rotated,
1138+
then delete the trusted timestamp and snapshot metadata files.** This is done
1139+
in order to recover from fast-forward attacks after the repository has been
11391140
compromised and recovered. A _fast-forward attack_ happens when attackers
11401141
arbitrarily increase the version numbers of: (1) the timestamp metadata, (2)
11411142
the snapshot metadata, and / or (3) the targets, or a delegated targets,
11421143
metadata file in the snapshot metadata. Please see [the Mercury
11431144
paper](https://ssl.engineering.nyu.edu/papers/kuppusamy-mercury-usenix-2017.pdf)
11441145
for more details.
11451146

1146-
* **1.11**. **Set whether consistent snapshots are used as per the trusted
1147+
* **5.1.11**. **Set whether consistent snapshots are used as per the trusted
11471148
root metadata file** (see Section 4.3).
11481149

1149-
**2**. **Download the timestamp metadata file**, up to X number of bytes
1150+
**5.2**. **Download the timestamp metadata file**, up to X number of bytes
11501151
(because the size is unknown). The value for X is set by the authors of the
11511152
application using TUF. For example, X may be tens of kilobytes. The filename
11521153
used to download the timestamp metadata file is of the fixed form FILENAME.EXT
11531154
(e.g., timestamp.json).
11541155

1155-
* **2.1**. **Check for an arbitrary software attack.** The new timestamp
1156+
* **5.2.1**. **Check for an arbitrary software attack.** The new timestamp
11561157
metadata file MUST have been signed by a threshold of keys specified in the
11571158
trusted root metadata file. If the new timestamp metadata file is not
11581159
properly signed, discard it, abort the update cycle, and report the signature
11591160
failure.
11601161

1161-
* **2.2**. **Check for a rollback attack.**
1162+
* **5.2.2**. **Check for a rollback attack.**
11621163

1163-
* **2.2.1**. The version number of the trusted timestamp metadata file, if
1164+
* **5.2.2.1**. The version number of the trusted timestamp metadata file, if
11641165
any, MUST be less than or equal to the version number of the new timestamp
11651166
metadata file. If the new timestamp metadata file is older than the
11661167
trusted timestamp metadata file, discard it, abort the update cycle, and
11671168
report the potential rollback attack.
11681169

1169-
* **2.2.2**. The version number of the snapshot metadata file in the
1170+
* **5.2.2.2**. The version number of the snapshot metadata file in the
11701171
trusted timestamp metadata file, if any, MUST be less than or equal to its
11711172
version number in the new timestamp metadata file. If not, discard the new
11721173
timestamp metadata file, abort the update cycle, and report the failure.
11731174

1174-
* **2.3**. **Check for a freeze attack.** The latest known time MUST be
1175+
* **5.2.3**. **Check for a freeze attack.** The latest known time MUST be
11751176
lower than the expiration timestamp in the new timestamp metadata file. If
11761177
so, the new timestamp metadata file becomes the trusted timestamp metadata
11771178
file. If the new timestamp metadata file has expired, discard it, abort the
11781179
update cycle, and report the potential freeze attack.
11791180

1180-
* **2.4**. **Persist timestamp metadata.** The client MUST write the file to
1181-
non-volatile storage as FILENAME.EXT (e.g. timestamp.json).
1181+
* **5.2.4**. **Persist timestamp metadata.** The client MUST write the file
1182+
to non-volatile storage as FILENAME.EXT (e.g. timestamp.json).
11821183

1183-
**3**. **Download snapshot metadata file**, up to either the number of bytes
1184+
**5.3**. **Download snapshot metadata file**, up to either the number of bytes
11841185
specified in the timestamp metadata file, or some Y number of bytes. The value
11851186
for Y is set by the authors of the application using TUF. For example, Y may be
11861187
tens of kilobytes. If consistent snapshots are not used (see
@@ -1190,19 +1191,19 @@ of the form VERSION_NUMBER.FILENAME.EXT (e.g., 42.snapshot.json), where
11901191
VERSION_NUMBER is the version number of the snapshot metadata file listed in
11911192
the timestamp metadata file.
11921193

1193-
* **3.1**. **Check against timestamp metadata.** The hashes and version
1194+
* **5.3.1**. **Check against timestamp metadata.** The hashes and version
11941195
number of the new snapshot metadata file MUST match the hashes, if any, and
11951196
version number listed in the trusted timestamp metadata. If hashes and
11961197
version do not match, discard the new snapshot metadata, abort the update
11971198
cycle, and report the failure.
11981199

1199-
* **3.2**. **Check for an arbitrary software attack.** The new snapshot
1200+
* **5.3.2**. **Check for an arbitrary software attack.** The new snapshot
12001201
metadata file MUST have been signed by a threshold of keys specified in the
12011202
trusted root metadata file. If the new snapshot metadata file is not signed
12021203
as required, discard it, abort the update cycle, and report the signature
12031204
failure.
12041205

1205-
* **3.3**. **Check for a rollback attack.** The version number of the targets
1206+
* **5.3.3**. **Check for a rollback attack.** The version number of the targets
12061207
metadata file, and all delegated targets metadata files, if any, in the
12071208
trusted snapshot metadata file, if any, MUST be less than or equal to its
12081209
version number in the new snapshot metadata file. Furthermore, any targets
@@ -1211,16 +1212,16 @@ the timestamp metadata file.
12111212
these conditions are not met, discard the new snapshot metadata file, abort
12121213
the update cycle, and report the failure.
12131214

1214-
* **3.4**. **Check for a freeze attack.** The latest known time MUST be
1215+
* **5.3.4**. **Check for a freeze attack.** The latest known time MUST be
12151216
lower than the expiration timestamp in the new snapshot metadata file. If
12161217
so, the new snapshot metadata file becomes the trusted snapshot metadata
12171218
file. If the new snapshot metadata file is expired, discard it, abort the
12181219
update cycle, and report the potential freeze attack.
12191220

1220-
* **3.5**. **Persist snapshot metadata.** The client MUST write the file to
1221+
* **5.3.5**. **Persist snapshot metadata.** The client MUST write the file to
12211222
non-volatile storage as FILENAME.EXT (e.g. snapshot.json).
12221223

1223-
**4**. **Download the top-level targets metadata file**, up to either the
1224+
**5.4**. **Download the top-level targets metadata file**, up to either the
12241225
number of bytes specified in the snapshot metadata file, or some Z number of
12251226
bytes. The value for Z is set by the authors of the application using TUF. For
12261227
example, Z may be tens of kilobytes. If consistent snapshots are not used (see
@@ -1230,60 +1231,61 @@ of the form VERSION_NUMBER.FILENAME.EXT (e.g., 42.targets.json), where
12301231
VERSION_NUMBER is the version number of the targets metadata file listed in the
12311232
snapshot metadata file.
12321233

1233-
* **4.1**. **Check against snapshot metadata.** The hashes and version
1234+
* **5.4.1**. **Check against snapshot metadata.** The hashes and version
12341235
number of the new targets metadata file MUST match the hashes, if any, and
12351236
version number listed in the trusted snapshot metadata. This is done, in
12361237
part, to prevent a mix-and-match attack by man-in-the-middle attackers. If
12371238
the new targets metadata file does not match, discard it, abort the update
12381239
cycle, and report the failure.
12391240

1240-
* **4.2**. **Check for an arbitrary software attack.** The new targets
1241+
* **5.4.2**. **Check for an arbitrary software attack.** The new targets
12411242
metadata file MUST have been signed by a threshold of keys specified in the
12421243
trusted root metadata file. If the new targets metadata file is not signed
12431244
as required, discard it, abort the update cycle, and report the failure.
12441245

1245-
* **4.3**. **Check for a freeze attack.** The latest known time MUST be
1246+
* **5.4.3**. **Check for a freeze attack.** The latest known time MUST be
12461247
lower than the expiration timestamp in the new targets metadata file. If so,
12471248
the new targets metadata file becomes the trusted targets metadata file. If
12481249
the new targets metadata file is expired, discard it, abort the update cycle,
12491250
and report the potential freeze attack.
12501251

1251-
* **4.4**. **Persist targets metadata.** The client MUST write the file to
1252+
* **5.4.4**. **Persist targets metadata.** The client MUST write the file to
12521253
non-volatile storage as FILENAME.EXT (e.g. targets.json).
12531254

1254-
* **4.5**. **Perform a pre-order depth-first search for metadata about the
1255+
* **5.4.5**. **Perform a pre-order depth-first search for metadata about the
12551256
desired target, beginning with the top-level targets role.** Note: If
1256-
any metadata requested in steps 4.4.1 - 4.4.2.3 cannot be downloaded nor
1257+
any metadata requested in steps 5.4.4.1 - 5.4.4.2.3 cannot be downloaded nor
12571258
validated, end the search and report that the target cannot be found.
12581259

1259-
* **4.5.1**. If this role has been visited before, then skip this role (so
1260-
that cycles in the delegation graph are avoided). Otherwise, if an
1260+
* **5.4.5.1**. If this role has been visited before, then skip this role
1261+
(so that cycles in the delegation graph are avoided). Otherwise, if an
12611262
application-specific maximum number of roles have been visited, then go to
12621263
step 5 (so that attackers cannot cause the client to waste excessive
12631264
bandwidth or time). Otherwise, if this role contains metadata about the
12641265
desired target, then go to step 5.
12651266

1266-
* **4.5.2**. Otherwise, recursively search the list of delegations in order
1267-
of appearance.
1267+
* **5.4.5.2**. Otherwise, recursively search the list of delegations in
1268+
order of appearance.
12681269

1269-
* **4.5.2.1**. If the current delegation is a multi-role delegation,
1270+
* **5.4.5.2.1**. If the current delegation is a multi-role delegation,
12701271
recursively visit each role, and check that each has signed exactly the
12711272
same non-custom metadata (i.e., length and hashes) about the target (or
12721273
the lack of any such metadata).
12731274

1274-
* **4.5.2.2**. If the current delegation is a terminating delegation,
1275+
* **5.4.5.2.2**. If the current delegation is a terminating delegation,
12751276
then jump to step 5.
12761277

1277-
* **4.5.2.3**. Otherwise, if the current delegation is a non-terminating
1278-
delegation, continue processing the next delegation, if any. Stop the
1279-
search, and jump to step 5 as soon as a delegation returns a result.
1278+
* **5.4.5.2.3**. Otherwise, if the current delegation is a
1279+
non-terminating delegation, continue processing the next delegation, if
1280+
any. Stop the search, and jump to step 5 as soon as a delegation returns
1281+
a result.
12801282

1281-
**5**. **Verify the desired target against its targets metadata**.
1283+
**5.5**. **Verify the desired target against its targets metadata**.
12821284

1283-
* **5.1**. If there is no targets metadata about this target, abort the
1285+
* **5.5.1**. If there is no targets metadata about this target, abort the
12841286
update cycle and report that there is no such target.
12851287

1286-
* **5.2**. Otherwise, download the target (up to the number of bytes
1288+
* **5.5.2**. Otherwise, download the target (up to the number of bytes
12871289
specified in the targets metadata), and verify that its hashes match the
12881290
targets metadata. (We download up to this number of bytes, because in some
12891291
cases, the exact number is unknown. This may happen, for example, if an
@@ -1332,8 +1334,7 @@ snapshot metadata file.
13321334
repository. This ensures that an outdated client can always correctly
13331335
re-trace the chain of trust across multiple root key updates, even if the
13341336
latest set of root keys on the client dates back multiple root metadata
1335-
versions. See step 1 of the client application workflow in Section 5 for
1336-
more details.
1337+
versions. See step 5.1 of the client application workflow for more details.
13371338

13381339
Note that an attacker, who controls the repository, can launch freeze
13391340
attacks by withholding new root metadata. The attacker does not need to

0 commit comments

Comments
 (0)