-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in-toto format with hashes of shards as subjects
This converts model serialization manifests that record every model file shard hash into an in-toto payload that can then be passed to Sigstore's `sign_intoto` for signing to generate a Sigstore `Bundle` (if using Sigstore). This time, we record every hash as part of the subject instead of in the payload. We require verifiers to be aware of this and acknowledge that verifiers that only check subject by subject (that is, they check if the hash of a passed in argument is in the list of subjects and don't check if all the hashes are present), can fail to fully detect if the model integrity is compromised by renaming one file in the model, interchanging two file names, deleting a file, or reordering two shards. The signing library will have additional checks for this, but verifying the signature with other tools might result in invalid results. Signed-off-by: Mihai Maruseac <[email protected]>
- Loading branch information
1 parent
a9c2d62
commit 5bdd5ad
Showing
9 changed files
with
368 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
model_signing/signing/testdata/in_toto/TestShardDigestsIntotoPayload/deep_model_folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"_type": "https://in-toto.io/Statement/v1", | ||
"subject": [ | ||
{ | ||
"name": "d0/d1/d2/d3/d4/f0:0:16", | ||
"digest": { | ||
"sha256": "6efa14bb03544fcb76045c55f25b9315b6eb5be2d8a85f703193a76b7874c6ff" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
}, | ||
{ | ||
"name": "d0/d1/d2/d3/d4/f1:0:16", | ||
"digest": { | ||
"sha256": "a9bc149b70b9d325cd68d275d582cfdb98c0347d3ce54590aa6533368daed3d2" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
}, | ||
{ | ||
"name": "d0/d1/d2/d3/d4/f2:0:16", | ||
"digest": { | ||
"sha256": "5f597e6a92d1324d9adbed43d527926d11d0131487baf315e65ae1ef3b1ca3c0" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
}, | ||
{ | ||
"name": "d0/d1/d2/d3/d4/f3:0:16", | ||
"digest": { | ||
"sha256": "eaf677c35fec6b87889d9e4563d8bb65dcb9869ca0225697c9cc44cf49dca008" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
} | ||
], | ||
"predicateType": "https://model_signing/ShardDigests/v0.1", | ||
"predicate": { | ||
"unused": "Unused, just passed due to API requirements" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
model_signing/signing/testdata/in_toto/TestShardDigestsIntotoPayload/empty_model_file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"_type": "https://in-toto.io/Statement/v1", | ||
"predicateType": "https://model_signing/ShardDigests/v0.1", | ||
"predicate": { | ||
"unused": "Unused, just passed due to API requirements" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
model_signing/signing/testdata/in_toto/TestShardDigestsIntotoPayload/empty_model_folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"_type": "https://in-toto.io/Statement/v1", | ||
"predicateType": "https://model_signing/ShardDigests/v0.1", | ||
"predicate": { | ||
"unused": "Unused, just passed due to API requirements" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...gning/signing/testdata/in_toto/TestShardDigestsIntotoPayload/model_folder_with_empty_file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"_type": "https://in-toto.io/Statement/v1", | ||
"predicateType": "https://model_signing/ShardDigests/v0.1", | ||
"predicate": { | ||
"unused": "Unused, just passed due to API requirements" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
model_signing/signing/testdata/in_toto/TestShardDigestsIntotoPayload/sample_model_file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"_type": "https://in-toto.io/Statement/v1", | ||
"subject": [ | ||
{ | ||
"name": ".:0:22", | ||
"digest": { | ||
"sha256": "3aab065c7181a173b5dd9e9d32a9f79923440b413be1e1ffcdba26a7365f719b" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
} | ||
], | ||
"predicateType": "https://model_signing/ShardDigests/v0.1", | ||
"predicate": { | ||
"unused": "Unused, just passed due to API requirements" | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
model_signing/signing/testdata/in_toto/TestShardDigestsIntotoPayload/sample_model_folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ | ||
"_type": "https://in-toto.io/Statement/v1", | ||
"subject": [ | ||
{ | ||
"name": "d0/f00:0:23", | ||
"digest": { | ||
"sha256": "fdd8925354242a7fd1515e79534317b800015607a609cd306e0b4dcfe6c92249" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
}, | ||
{ | ||
"name": "d0/f01:0:23", | ||
"digest": { | ||
"sha256": "e16940b5e44ce981150bda37c4ba95881a749a521b4a297c5cdf97bdcfe965e6" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
}, | ||
{ | ||
"name": "d0/f02:0:23", | ||
"digest": { | ||
"sha256": "407822246ea8f9e26380842c3f4cd10d7b23e78f1fe7c74c293608682886a426" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
}, | ||
{ | ||
"name": "d1/f10:0:23", | ||
"digest": { | ||
"sha256": "6a3b08b5df77c4d418ceee1ac136a9ad49fc7c41358b5e82c1176daccb21ff3f" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
}, | ||
{ | ||
"name": "d1/f11:0:23", | ||
"digest": { | ||
"sha256": "a484b3d8ea5e99b75f9f123f9a42c882388693edc7d85d82ccba54834712cadf" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
}, | ||
{ | ||
"name": "d1/f12:0:23", | ||
"digest": { | ||
"sha256": "8f577930f5f40c2c2133cb299d36f9527fde98c1608569017cae6b5bcd01abb3" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
}, | ||
{ | ||
"name": "f0:0:24", | ||
"digest": { | ||
"sha256": "997b37cc51f1ca1c7a270466607e26847429cd7264c30148c1b9352e224083fc" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
}, | ||
{ | ||
"name": "f1:0:24", | ||
"digest": { | ||
"sha256": "c88a04d48353133fb065ba2c8ab369abab21395b9526aa20373ad828915fa7ae" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
}, | ||
{ | ||
"name": "f2:0:24", | ||
"digest": { | ||
"sha256": "700e3ba5065d8dd47e41fd928ea086670d628f891ba363be0ca3c31d20d7d719" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
}, | ||
{ | ||
"name": "f3:0:24", | ||
"digest": { | ||
"sha256": "912bcf5ebdf44dc7b4085b07940e0a81d157fba24b276e73fd911121d4544c4a" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
} | ||
], | ||
"predicateType": "https://model_signing/ShardDigests/v0.1", | ||
"predicate": { | ||
"unused": "Unused, just passed due to API requirements" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
model_signing/signing/testdata/in_toto/TestShardDigestsIntotoPayload/symlink_model_folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"_type": "https://in-toto.io/Statement/v1", | ||
"subject": [ | ||
{ | ||
"name": "symlink_file:0:22", | ||
"digest": { | ||
"sha256": "3aab065c7181a173b5dd9e9d32a9f79923440b413be1e1ffcdba26a7365f719b" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256-1000000" | ||
} | ||
} | ||
], | ||
"predicateType": "https://model_signing/ShardDigests/v0.1", | ||
"predicate": { | ||
"unused": "Unused, just passed due to API requirements" | ||
} | ||
} |