You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tap14.md
+88-58Lines changed: 88 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
* TAP: 14
2
2
* Title: Managing TUF Versions
3
3
* Version: 1
4
-
* Last-Modified: 07-October-2022
4
+
* Last-Modified: 13-October-2022
5
5
* Author: Marina Moore, Justin Cappos
6
-
* Status: Draft
6
+
* Status: Deferred
7
7
* Content-Type: text/markdown
8
8
* Created: 19-December-2018
9
9
@@ -160,7 +160,10 @@ period of time after upgrading. This grace period gives existing clients that
160
160
implement old versions of the TUF specification time to implement support for a
161
161
new specification version. Repositories achieve this using a directory structure
162
162
with a directory for each supported TUF specification version. These directories
163
-
contain metadata that supports the given TUF specification version. Using these
163
+
contain metadata that supports the given TUF specification version. The
164
+
repository may generate metadata for each directory using independent,
165
+
version-specific code, or they may optimize when there is redundant metadata
166
+
between different versions of the specification. Using these
164
167
directories, a client is able to choose the most recent metadata they support.
165
168
More details about this directory structure are contained in the [specification](#how-a-repository-updates).
166
169
This TAP will also add a `supported_versions` field to root metadata so that the client
@@ -253,21 +256,74 @@ specification versions in new
253
256
directories. In addition, root metadata on a repository MUST add a `supported_versions` field
254
257
to indicate which specification versions are supported.
255
258
259
+
In order to fascilitate the upgrade to a new specification version, root metadata for all supported spec versions MUST add a `supported_versions` field before upgrading to spec version 2.0.0.
260
+
This field will serve two purpose.
261
+
262
+
263
+
First, not all TUF repositories have a mechanism that is able to list all directories
264
+
in a folder (the equivalent of the `ls` command). For these repositories (such
265
+
as OCI registries or http servers), as well as to prevent specification version
266
+
freeze attacks, the `supported_versions` field will lists
267
+
all versions supported by the repository to allow for client discovery.
268
+
269
+
Second, the root metadata format or versioning scheme may change between major specification versions.
270
+
The `supported_versions` field will contain the filename and a secure hash of the first root metadata file that should be used in the new specification version.
271
+
272
+
As it is
273
+
included in root metadata, the contents of `supported_versions` will be signed by a threshold of root keys, securing against a specification version rollback, and signing the new trusted root metadata.
274
+
This field will contain the following:
275
+
276
+
```
277
+
{ ...,
278
+
"supported_versions" : [
279
+
{ "version": MAJOR_VERSION,
280
+
"path": VERSION_PATH,
281
+
"features": FEATURES_STRING,
282
+
"root-filename": ROOT_FILENAME,
283
+
"root-digest": ROOT_DIGEST
284
+
},
285
+
...
286
+
]
287
+
}
288
+
289
+
```
290
+
291
+
where `MAJOR_VERSION` is the integer representing a supported major version
292
+
For backwards compatability, version 1 should be assumed to be in the top-level
293
+
repository with no directory named 1. `ROOT_FILENAME` is the name of the root metadata file in the new specification version. `ROOT_DIGEST` is the digest of the new root metadata file.
294
+
`VERSION_PATH` is the path to the directory for this version. In many cases, this will match the specification version, ie "2/".
295
+
`FEATURES_STRING` is a string for the features supported in this version. This string may be used to include an API version for a particular implementation, or to indicate which features in a new specification version are supported. This field MAY be empty, but if it is used, the client MUST ensure that they support the features used. A combination of the specification version and features string will be used to determine which version the client should use.
296
+
297
+
All entries in `supported-versions` will be in priority order so that a client will use the last specification version and feature combination that they support.
298
+
299
+
The `root-digest` field MUST be empty for the supported version that matches the
300
+
specification version and features string used by the current root metadata file. `supported_versions`
301
+
MAY leave out the specification version used by the current root metadata, and any
302
+
older specification versions. So all supported versions greater than the specification
303
+
version of the root metadata MUST be included, and any less than or equal to
304
+
the current specification version MAY be included.
305
+
306
+
A repository should generate all TUF metadata, including root metadata, for all
307
+
TUF versions that the repository supports. Any update to TUF targets or delegations should be reflected across
308
+
all of these versions.
309
+
256
310
As described in the [Rationale](#rationale), repositories should support multiple
257
311
TUF specification versions. In order to do so, this TAP proposes a new directory
258
312
structure for repositories. When a repository manager chooses to upgrade to a
259
-
new major TUF specification version, they create a new directory on the repository named
260
-
for the major version (for example 2). This directory will contain all
313
+
new major TUF specification version, they create a new directory on the repository
314
+
for the major version and feature set (for example "2" for version 2). This directory will contain all
261
315
metadata files for the new specification version, but target files will remain in the
262
316
parent directory to save space. In this case the metadata files (in directories according to their spec
263
317
version) can point to target files relative to the parent directory. After creating
264
318
the directory, the repository creates and signs root, snapshot, timestamp, and
265
319
top-level targets metadata using the new TUF specification version and places these
266
-
metadata files in the directory. The root file should be signed by both the new
267
-
root key and the current root key (the root key from the most recent metadata in
268
-
the previous major specification version). The new supported version number, and information about the new root metadata will then be added to `supported-versions` in all previously supported specification versions. Clients will now be able to use the new
269
-
metadata files once their TUF specification versions are also updated. After an update to
270
-
version 2.0.0, the repository structure may look like:
320
+
metadata files in the directory. The root file should be signed by the new root keys
321
+
listed in the file. A digest of the signed root metadata, along with the new
322
+
supported version number will then be added to the `supported_versions` field in
323
+
a new root metadata file for all previously supported specififcation versions.
324
+
Clients will now be able to use the new metadata files once their TUF specification
325
+
versions are also updated. After an update to version 2.0.0, the repository
326
+
structure may look like:
271
327
272
328
273
329
```
@@ -281,7 +337,7 @@ version 2.0.0, the repository structure may look like:
281
337
Repository updates to a new minor or patch specification version shall be done
282
338
by uploading new metadata files in the new format to the proper directory. So if
283
339
a repository updates from 2.0.0 to 2.1.0, the 2.1.0 metadata would go in the
284
-
directory named 2. Minor and patch version changes are backwards compatible,
340
+
same directory. Minor and patch version changes are backwards compatible,
285
341
so clients using version 2.0.0 will still be able to parse metadata written
286
342
using version 2.1.0.
287
343
@@ -341,7 +397,7 @@ And the "signed" portion of root will include:
341
397
}
342
398
```
343
399
344
-
where `BECOMES_OBSOLETE` is a timestamp.
400
+
where `BECOMES_OBSOLETE` is a date-time string with the same format as `expires`
345
401
346
402
For existing TUF clients to continue operation after this TAP is implemented,
347
403
repositories may store metadata from before TUF 2.0.0 in the top-level
@@ -357,48 +413,24 @@ upgrades from version 1.x.y to version 2.0.0 may look like:
357
413
|- 2.x.y metadata files
358
414
```
359
415
360
-
In order to fascilitate the upgrade to a new specification version, root metadata for all supported spec versions MUST add a `supported_versions` field before upgrading to spec version 2.0.0.
361
-
This field will serve two purpose.
362
416
417
+
### Generating metadata for multiple specification versions
363
418
364
-
First, not all TUF repositories have a mechanism that is able to list all directories
365
-
in a folder (the equivalent of the `ls` command). For these repositories (such
366
-
as OCI registries or http servers), as well as to prevent specification version
367
-
freeze attacks, the `supported_versions` field will lists
368
-
all versions supported by the repository to allow for client discovery.
419
+
There are a couple of strategies that repositories MAY employ to generate TUF
420
+
metadata for multiple specification versions. The simplest option is for
421
+
repositories to keep a fork of the code that uses
422
+
the old specification version, and generate all metadata for each specification
423
+
version using both this fork and the latest code. For efficiency, repositories
424
+
may instead re-generate only those metadata files that were effected by the
425
+
breaking changes in the specification. For example, if version 3.0.0 introduces
426
+
a new snapshot metadata format, a repository that supports major versions 2 and
427
+
3 may generate all metadata using the latest version, then call just the
428
+
functions from the version 2 code that are used to generate snapshot metadata.
369
429
370
-
Second, the root metadata format or versioning scheme may change between major specification versions.
371
-
The `supported_versions` field will contain the filename and a secure hash of the first root metadata file that should be used in the new specification version.
372
-
373
-
As it is
374
-
included in root metadata, the contents of `supported_versions` will be signed by a threshold of root keys, securing against a specification version rollback, and signing the new trusted root metadata.
375
-
This field will contain the following:
376
-
377
-
```
378
-
{ ...,
379
-
"supported_versions" : [
380
-
{ "version": MAJOR_VERSION,
381
-
"path": FOLDER_NAME,
382
-
"root-filename": ROOT_FILENAME,
383
-
"root-digest": ROOT_DIGEST
384
-
},
385
-
...
386
-
]
387
-
}
388
-
389
-
```
390
-
391
-
where `MAJOR_VERSION` is the integer representing a supported major version
392
-
and `FOLDER_NAME` is the string representing the folder containing metadata for
393
-
this supported major version (e.g. { "version": 2, "path": "2" }).
394
-
`FOLDER_NAME` MUST NOT contain any subdirectories.
395
-
In most cases, `MAJOR_VERSION` should match `FOLDER_NAME`.
396
-
For backwards compatability, version 1 should be assumed to be in the top-level
397
-
repository with no directory named 1. `ROOT_FILENAME` is the name of the root metadata file in the new specification version. `ROOT_DIGEST` is the digest of the new root metadata file.
398
-
399
-
A repository should generate all TUF metadata, including root metadata, for all
400
-
TUF versions that the repository supports. Any update to TUF targets or delegations should be reflected across
401
-
all of these versions.
430
+
For additional optimizations, the repository could generate any duplicate
431
+
metadata files only once in the most recent specification version directory, then
432
+
hard link to this copy from other directories. This strategy has been used to link
433
+
duplicate metadata files used for consistent snapshots.
402
434
403
435
## Changes to TUF clients
404
436
@@ -441,13 +473,11 @@ parsing the `supported_versions` field in the currently trusted root metadata.
441
473
* If the latest version on the repository is lower than the previous
442
474
specification version the client used from this repository, the client
443
475
should report an error and terminate the update.
444
-
* If the latest version on the repository is equal to that of the client, it
476
+
* If the latest version on the repository is equal to the latest version of the client, it
445
477
will use this version to download metadata.
446
-
* If the latest version pre-dates the client specification version, it may call functions
447
-
from a previous client version to download the metadata. The client may support
448
-
as many or as few versions as desired for the application. If the previous
449
-
version is not available, the client shall report that an update can not be
450
-
performed due to an old specification version on the repository.
478
+
* If the latest version on the repository is less that the latest version of the client specification version, the client may use the latest version on the repository
479
+
if this version is supported by the client. If this version is not supported by the client, the client shall report that an update can not be
480
+
performed due to an old specification version on the repository.
451
481
* If the latest version on the repository is higher than the client spec
452
482
version, the client should report to the user that it is not using the most up
453
483
to date version, and then perform the update with the directory that corresponds with the latest
@@ -601,7 +631,7 @@ in the specification section.
601
631
# Augmented Reference Implementation
602
632
603
633
Semantic Versioning was added to the TUF Reference Implementation in [#914](https://github.com/theupdateframework/python-tuf/pull/914).
604
-
The rest of this proposal has not yet been implemented.
634
+
The rest of the proposal is implemented as a proof of conceps in [#2114](https://github.com/theupdateframework/python-tuf/pull/2114). The pr can be finalized once this TAP is accepted.
0 commit comments