Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEP-0091] add VerificationResult #6663

Merged
merged 1 commit into from
May 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions pkg/trustedresources/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,28 @@ const (
SignatureAnnotation = "tekton.dev/signature"
)

const (
VerificationSkip = iota
VerificationPass
VerificationWarn
VerificationError
)

// VerificationResultType indicates different cases of a verification result
type VerificationResultType int

// VerificationResult contains the type and message about the result of verification
type VerificationResult struct {
// VerificationResultType has 4 types which is corresponding to 4 cases:
// 0 (VerificationSkip): The verification was skipped. Err is nil in this case.
// 1 (VerificationPass): The verification passed. Err is nil in this case.
// 2 (VerificationWarn): A warning is logged. It could be no matching policies and feature flag "no-match-policy" is "warn", or only Warn mode verification policies fail.
// 3 (VerificationError): The verification failed, it could be the signature doesn't match the public key, no matching policies and "no-match-policy" is set to "fail" or there are errors during verification.
VerificationResultType VerificationResultType
// Err contains the error message when there is a warning logged or error returned.
Err error
}

// VerifyTask verifies the signature and public key against task.
// Skip the verification when no policies are found and trusted-resources-verification-no-match-policy is set to ignore or warn
// Return an error when no policies are found and trusted-resources-verification-no-match-policy is set to fail,
Expand Down