{"record":{"id":"10874a5dc015269f","repo":"slackhq/nebula","slug":"config-s-interfaces-has-invalid-key-s-v","errorCode":null,"errorMessage":"config `%s.interfaces` has invalid key: %s: %v","messagePattern":"config `(.+?)\\.interfaces` has invalid key: (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"allow_list.go","lineNumber":189,"sourceCode":"func getAllowListInterfaces(k string, v any) ([]AllowListNameRule, error) {\n\tvar nameRules []AllowListNameRule\n\n\trawRules, ok := v.(map[string]any)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"config `%s.interfaces` is invalid (type %T): %v\", k, v, v)\n\t}\n\n\tfirstEntry := true\n\tvar allValues bool\n\tfor name, rawAllow := range rawRules {\n\t\tallow, ok := config.AsBool(rawAllow)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"config `%s.interfaces` has invalid value (type %T): %v\", k, rawAllow, rawAllow)\n\t\t}\n\n\t\tnameRE, err := regexp.Compile(\"^\" + name + \"$\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"config `%s.interfaces` has invalid key: %s: %v\", k, name, err)\n\t\t}\n\n\t\tnameRules = append(nameRules, AllowListNameRule{\n\t\t\tName:  nameRE,\n\t\t\tAllow: allow,\n\t\t})\n\n\t\tif firstEntry {\n\t\t\tallValues = allow\n\t\t\tfirstEntry = false\n\t\t} else {\n\t\t\tif allow != allValues {\n\t\t\t\treturn nil, fmt.Errorf(\"config `%s.interfaces` values must all be the same true/false value\", k)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nameRules, nil","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/allow_list.go#L171-L207","documentation":"Each key in the `interfaces` map is compiled as an anchored regex (\"^\" + name + \"$\") to match interface names. If the key is not a valid regular expression, the config is rejected and the regexp error is included in the message.","triggerScenarios":"getAllowListInterfaces with keys containing invalid regex syntax, e.g. unbalanced parentheses, stray *, or invalid character classes like eth[0-.","commonSituations":"Writing glob-style patterns (eth*) instead of regex (eth.*), or typos in wildcard patterns.","solutions":["Fix the key to be a valid regex, e.g. use eth.* instead of eth*","Escape literal special characters: \\\\* becomes \\\\* in regex terms (use \\\\-escaped literals)","Test the pattern with any Go regexp validator before deploying"],"exampleFix":"// before\ninterfaces:\n  \"eth(\": true\n// after\ninterfaces:\n  \"eth.*\": true","handlingStrategy":"validation","validationCode":"func validInterfaceKeys(m map[string]any) error {\n\tfor name := range m {\n\t\tif _, err := regexp.Compile(\"^\" + name + \"$\"); err != nil {\n\t\t\treturn fmt.Errorf(\"bad interface pattern %q: %w\", name, err)\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember keys are regexes, not globs: use .* not *","Compile-test patterns in CI before deployment"],"tags":["config","regex","interfaces","allowlist"],"backgroundTag":"invalid-regex-pattern","analyzedSha":"dd8f660c0ac37903ec4080ca4d3c861ba9342ceb","analyzedAt":"2026-09-03T11:13:55.444Z","contentChangedAt":"2026-09-03T11:13:55.444Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}