Skip to content
This repository was archived by the owner on Nov 14, 2024. It is now read-only.

Commit 3c80a35

Browse files
author
Jonathan Yu
authored
chore: check error from CompactRules (#23)
The function currently never returns errors, but this is not guaranteed to remain the case in the future, nor by the API contract, so it's safer to check.
1 parent 5549210 commit 3c80a35

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/checks/kube/rbac.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ func (k *KubernetesChecker) checkRBACDefault(ctx context.Context) ([]*api.CheckR
7070
breakdownRules = append(breakdownRules, rbacutil.BreakdownRule(rule)...)
7171
}
7272

73-
compactRules, _ := rbacutil.CompactRules(breakdownRules) //nolint:errcheck - err is always nil
73+
compactRules, err := rbacutil.CompactRules(breakdownRules)
74+
if err != nil {
75+
return nil, xerrors.Errorf("compact rules: %w", err)
76+
}
77+
7478
sort.Stable(rbacutil.SortableRuleSlice(compactRules))
7579
for _, r := range compactRules {
7680
k.log.Debug(ctx, "Got SSRR PolicyRule", slog.F("rule", r))

0 commit comments

Comments
 (0)