Commit e8c9dd0
committed
When updating timestamp, make sure we aren't rolling back snapshot
This implements [TUF-1.0.5 §5.2.2.2], which states:
> The version number of the targets metadata file, and all
> delegated targets metadata files (if any), in the trusted snapshot metadata
> file, if any, MUST be less than or equal to its version number in the new
> snapshot metadata file. Furthermore, any targets metadata filename that was
> listed in the trusted snapshot metadata file, if any, MUST continue to be
> listed in the new snapshot metadata file. If any of these conditions are
> not met, discard the new snapshot metadadata file, abort the update cycle,
> and report the failure.
Furthermore, it adds three tests to:
* make sure rollbacks are prevented
* that trusted target roles cannot be removed in a normal update.
* that we can remove a target role with a root roll.
Fixes #294.
[TUF-1.0.5 §5.2.2.2]: https://github.com/theupdateframework/specification/blob/39c80de07407bd4251ad823976dc4116a4b05043/tuf-spec.md?plain=1#L11631 parent 0c08b7d commit e8c9dd0
1 file changed
Lines changed: 62 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
427 | | - | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
428 | 436 | | |
429 | 437 | | |
430 | 438 | | |
| |||
1370 | 1378 | | |
1371 | 1379 | | |
1372 | 1380 | | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
1373 | 1434 | | |
1374 | 1435 | | |
1375 | 1436 | | |
| |||
0 commit comments