Skip to content

Commit 0d9e91d

Browse files
committed
Check for nil errors in PreAuthorize before appending
Signed-off-by: Tayler Geiger <[email protected]>
1 parent 414db44 commit 0d9e91d

File tree

1 file changed

+6
-2
lines changed
  • internal/operator-controller/authorization

1 file changed

+6
-2
lines changed

internal/operator-controller/authorization/rbac.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,12 @@ func (a *rbacPreAuthorizer) PreAuthorize(ctx context.Context, ext *ocv1.ClusterE
100100
if err := ec.checkEscalation(ctx, manifestManager, obj); err != nil {
101101
result, err := parseEscalationErrorForMissingRules(err)
102102
missingRules[obj.GetNamespace()] = append(missingRules[obj.GetNamespace()], result.MissingRules...)
103-
preAuthEvaluationErrors = append(preAuthEvaluationErrors, result.ResolutionErrors)
104-
parseErrors = append(parseErrors, err)
103+
if result.ResolutionErrors != nil {
104+
preAuthEvaluationErrors = append(preAuthEvaluationErrors, result.ResolutionErrors)
105+
}
106+
if err != nil {
107+
parseErrors = append(parseErrors, err)
108+
}
105109
}
106110
}
107111
allMissingPolicyRules := make([]ScopedPolicyRules, 0, len(missingRules))

0 commit comments

Comments
 (0)