From e1ff7c26d05c6350146f3df922b7f3acfe35d9f1 Mon Sep 17 00:00:00 2001 From: georgibaltiev Date: Thu, 9 Jan 2025 16:56:34 +0200 Subject: [PATCH] Fix typo --- .../managedk8s/ruleset/securityhardenedk8s/rules/2001.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/provider/managedk8s/ruleset/securityhardenedk8s/rules/2001.go b/pkg/provider/managedk8s/ruleset/securityhardenedk8s/rules/2001.go index 581130a8..375b4e98 100644 --- a/pkg/provider/managedk8s/ruleset/securityhardenedk8s/rules/2001.go +++ b/pkg/provider/managedk8s/ruleset/securityhardenedk8s/rules/2001.go @@ -68,8 +68,8 @@ func (r *Rule2001) Run(ctx context.Context) (rule.RuleResult, error) { if securityContext.Capabilities != nil { // CAP_SYS_ADMIN only works on CRI-O. ref: https://github.com/kubernetes/kubernetes/issues/119568 // Valiadated with `ubuntu` container, to check enabled capabilities the `capsh --print` command can be used. - addsCapSysAdmin = slices.ContainsFunc(securityContext.Capabilities.Add, func(cap corev1.Capability) bool { - return strings.ToUpper(string(cap)) == "SYS_ADMIN" || strings.ToUpper(string(cap)) == "CAP_SYS_ADMIN" + addsCapSysAdmin = slices.ContainsFunc(securityContext.Capabilities.Add, func(capability corev1.Capability) bool { + return strings.ToUpper(string(capability)) == "SYS_ADMIN" || strings.ToUpper(string(capability)) == "CAP_SYS_ADMIN" }) }