-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't fail on TSA signatures we can't verify (#45)
For #43 As long as there are enough TSA signatures that do verify to meet the threshold specified by the verification policy. --------- Signed-off-by: Zach Steindler <[email protected]>
- Loading branch information
Showing
2 changed files
with
40 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,34 @@ func TestTimestampAuthorityVerifier(t *testing.T) { | |
|
||
_, err = verify.VerifyTimestampAuthority(entity, virtualSigstore2, 1) | ||
assert.Error(t, err) // different sigstore instance should fail to verify | ||
|
||
untrustedEntity, err := virtualSigstore2.Attest("[email protected]", "issuer", []byte("statement")) | ||
assert.NoError(t, err) | ||
|
||
_, err = verify.VerifyTimestampAuthority(&oneTrustedOneUntrustedTimestampEntity{entity, untrustedEntity}, virtualSigstore, 1) | ||
assert.NoError(t, err) | ||
|
||
_, err = verify.VerifyTimestampAuthority(&oneTrustedOneUntrustedTimestampEntity{entity, untrustedEntity}, virtualSigstore, 2) | ||
assert.Error(t, err) // only 1 trusted should not meet threshold of 2 | ||
} | ||
|
||
type oneTrustedOneUntrustedTimestampEntity struct { | ||
*ca.TestEntity | ||
UntrustedTestEntity *ca.TestEntity | ||
} | ||
|
||
func (e *oneTrustedOneUntrustedTimestampEntity) Timestamps() ([][]byte, error) { | ||
timestamps, err := e.TestEntity.Timestamps() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
untrustedTimestamps, err := e.UntrustedTestEntity.Timestamps() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return append(timestamps, untrustedTimestamps...), nil | ||
} | ||
|
||
type dupTimestampEntity struct { | ||
|