Skip to content

Commit ba4372e

Browse files
refactor(cli): remove unreachable policy-violation fallback handling
Signed-off-by: Matías Insaurralde <matias@chainloop.dev>
1 parent 2bae076 commit ba4372e

2 files changed

Lines changed: 2 additions & 12 deletions

File tree

app/cli/cmd/attestation_push.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ func newAttestationPushCmd() *cobra.Command {
163163
const exceptionFlagName = "exception-bypass-policy-check"
164164

165165
var (
166-
ErrBlockedByPolicyViolation = fmt.Errorf("the operator requires all policies to pass before continuing, please fix them and try again or temporarily bypass the policy check using --%s", exceptionFlagName)
167-
exceptionBypassPolicyCheck = fmt.Sprintf("Attention: You have opted to bypass the policy enforcement check and an operator has been notified of this exception.\nPlease make sure you are back on track with the policy evaluations and remove the --%s as soon as possible.", exceptionFlagName)
166+
exceptionBypassPolicyCheck = fmt.Sprintf("Attention: You have opted to bypass the policy enforcement check and an operator has been notified of this exception.\nPlease make sure you are back on track with the policy evaluations and remove the --%s as soon as possible.", exceptionFlagName)
168167
)
169168

170169
type GateError struct {
@@ -202,12 +201,6 @@ func validatePolicyEnforcement(status *action.AttestationStatusResult, bypassPol
202201
return nil
203202
}
204203

205-
// Effective gate semantics are already resolved in policy evaluations.
206-
// For backwards compatibility, fall back to aggregate status only if
207-
// no evaluations are available.
208-
if len(status.PolicyEvaluations) == 0 && status.HasPolicyViolations {
209-
return ErrBlockedByPolicyViolation
210-
}
211204
}
212205

213206
return nil

app/cli/main.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2023-2025 The Chainloop Authors.
2+
// Copyright 2023-2026 The Chainloop Authors.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -100,9 +100,6 @@ func errorInfo(err error, logger zerolog.Logger) (string, int) {
100100
logger.Debug().Msg("GracefulErrorExit enabled (exitCode 0). If you want to disable it set --graceful-exit=false")
101101
exitCode = 0
102102
}
103-
case errors.Is(err, cmd.ErrBlockedByPolicyViolation):
104-
// default exit code for policy violations
105-
exitCode = 3
106103
case errors.As(err, &gateErr):
107104
// exit code for gate errors
108105
exitCode = 4

0 commit comments

Comments
 (0)