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

feat: add required log #221

Merged
merged 17 commits into from
Dec 5, 2022
4 changes: 3 additions & 1 deletion notation.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func Sign(ctx context.Context, signer Signer, repo registry.Repository, opts Sig
return ocispec.Descriptor{}, err
}
logger.Debugf("Generated annotations: %+v", annotations)
logger.Debugf("Pushing signature of artifact descriptor: %+v", targetDesc)
logger.Debugf("Pushing signature of artifact descriptor: %+v, signature media type: %v", targetDesc, opts.SignatureMediaType)
_, _, err = repo.PushSignature(ctx, opts.SignatureMediaType, sig, targetDesc, annotations)
if err != nil {
return ocispec.Descriptor{}, err
Expand Down Expand Up @@ -249,6 +249,8 @@ func Verify(ctx context.Context, verifier Verifier, repo registry.Repository, re
if err != nil {
return ErrorSignatureRetrievalFailed{Msg: fmt.Sprintf("unable to retrieve digital signature with digest %q associated with %q from the registry, error : %v", sigManifestDesc.Digest, artifactRef, err.Error())}
}
logger.Debugf("signature media type: %v", sigDesc.MediaType)

// using signature media type fetched from registry
opts.SignatureMediaType = sigDesc.MediaType

Expand Down
6 changes: 3 additions & 3 deletions verifier/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func (v *verifier) processSignature(ctx context.Context, sigBlob []byte, envelop
}

if len(capabilitiesToVerify) > 0 {
logger.Debugf("Executing verification plugin with capabilities %v", capabilitiesToVerify)
logger.Debugf("Executing verification plugin %q with capabilities %v", verificationPluginName, capabilitiesToVerify)
response, err := executePlugin(ctx, installedPlugin, trustPolicy, capabilitiesToVerify, outcome.EnvelopeContent, pluginConfig)
if err != nil {
return err
JeyJeyGao marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -554,8 +554,8 @@ func logVerificationResult(logger log.Logger, result *notation.ValidationResult)
}
switch result.Action {
case trustpolicy.ActionLog:
logger.Warnf("%v validation failed with validation action set to \"logged\". Failure reason: %v", result.Type, result.Error)
logger.Warnf("%v validation failed with validation action set to \"logged\". Failure reason: %v", strings.Title(string(result.Type)), result.Error)
case trustpolicy.ActionEnforce:
logger.Errorf("%v validation failed. Failure reason: %v", result.Type, result.Error)
logger.Errorf("%v validation failed. Failure reason: %v", strings.Title(string(result.Type)), result.Error)
JeyJeyGao marked this conversation as resolved.
Show resolved Hide resolved
}
}