diff --git a/pkg/sysctl/sysctl.go b/pkg/sysctl/sysctl.go index eaf5cc66e7..9263923c1f 100644 --- a/pkg/sysctl/sysctl.go +++ b/pkg/sysctl/sysctl.go @@ -30,6 +30,12 @@ func Validate(strSlice []string) (map[string]string, error) { if len(arr) < 2 { return nil, errors.Errorf("%s is invalid, sysctl values must be in the form of KEY=VALUE", val) } + + trimmed := fmt.Sprintf("%s=%s", strings.TrimSpace(arr[0]), strings.TrimSpace(arr[1])) + if trimmed != val { + return nil, errors.Errorf("'%s' is invalid, extra spaces found", val) + } + if validSysctlMap[arr[0]] { sysctl[arr[0]] = arr[1] continue @@ -43,7 +49,7 @@ func Validate(strSlice []string) (map[string]string, error) { } } if !foundMatch { - return nil, errors.Errorf("sysctl '%s' is not whitelisted", arr[0]) + return nil, errors.Errorf("sysctl '%s' is not allowed", arr[0]) } } return sysctl, nil