-
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 files as subjects (#266)
This converts model serialization manifests that record every model file 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, or deleting a file. 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
313af3a
commit c662544
Showing
9 changed files
with
408 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/TestDigestsIntotoPayload/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", | ||
"digest": { | ||
"sha256": "6efa14bb03544fcb76045c55f25b9315b6eb5be2d8a85f703193a76b7874c6ff" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256" | ||
} | ||
}, | ||
{ | ||
"name": "d0/d1/d2/d3/d4/f1", | ||
"digest": { | ||
"sha256": "a9bc149b70b9d325cd68d275d582cfdb98c0347d3ce54590aa6533368daed3d2" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256" | ||
} | ||
}, | ||
{ | ||
"name": "d0/d1/d2/d3/d4/f2", | ||
"digest": { | ||
"sha256": "5f597e6a92d1324d9adbed43d527926d11d0131487baf315e65ae1ef3b1ca3c0" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256" | ||
} | ||
}, | ||
{ | ||
"name": "d0/d1/d2/d3/d4/f3", | ||
"digest": { | ||
"sha256": "eaf677c35fec6b87889d9e4563d8bb65dcb9869ca0225697c9cc44cf49dca008" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256" | ||
} | ||
} | ||
], | ||
"predicateType": "https://model_signing/Digests/v0.1", | ||
"predicate": { | ||
"unused": "Unused, just passed due to API requirements" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
model_signing/signing/testdata/in_toto/TestDigestsIntotoPayload/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,18 @@ | ||
{ | ||
"_type": "https://in-toto.io/Statement/v1", | ||
"subject": [ | ||
{ | ||
"name": ".", | ||
"digest": { | ||
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256" | ||
} | ||
} | ||
], | ||
"predicateType": "https://model_signing/Digests/v0.1", | ||
"predicate": { | ||
"unused": "Unused, just passed due to API requirements" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
model_signing/signing/testdata/in_toto/TestDigestsIntotoPayload/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/Digests/v0.1", | ||
"predicate": { | ||
"unused": "Unused, just passed due to API requirements" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
model_signing/signing/testdata/in_toto/TestDigestsIntotoPayload/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,18 @@ | ||
{ | ||
"_type": "https://in-toto.io/Statement/v1", | ||
"subject": [ | ||
{ | ||
"name": "empty_file", | ||
"digest": { | ||
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256" | ||
} | ||
} | ||
], | ||
"predicateType": "https://model_signing/Digests/v0.1", | ||
"predicate": { | ||
"unused": "Unused, just passed due to API requirements" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
model_signing/signing/testdata/in_toto/TestDigestsIntotoPayload/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": ".", | ||
"digest": { | ||
"sha256": "3aab065c7181a173b5dd9e9d32a9f79923440b413be1e1ffcdba26a7365f719b" | ||
}, | ||
"annotations": { | ||
"actual_hash_algorithm": "file-sha256" | ||
} | ||
} | ||
], | ||
"predicateType": "https://model_signing/Digests/v0.1", | ||
"predicate": { | ||
"unused": "Unused, just passed due to API requirements" | ||
} | ||
} |
Oops, something went wrong.