{"record":{"id":"279467693e7e4d3e","repo":"crowdsecurity/crowdsec","slug":"webhook-path-cannot-be-empty","errorCode":null,"errorMessage":"webhook_path cannot be empty","messagePattern":"webhook_path cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/kubernetesaudit/config.go","lineNumber":76,"sourceCode":"\t\treturn err\n\t}\n\n\ts.config = cfg\n\n\treturn nil\n}\n\nfunc (c *Configuration) Validate() error {\n\tif c.ListenAddr == \"\" {\n\t\treturn errors.New(\"listen_addr cannot be empty\")\n\t}\n\n\tif c.ListenPort == 0 {\n\t\treturn errors.New(\"listen_port cannot be empty\")\n\t}\n\n\tif c.WebhookPath == \"\" {\n\t\treturn errors.New(\"webhook_path cannot be empty\")\n\t}\n\n\tif c.MaxBodySize != nil && *c.MaxBodySize <= 0 {\n\t\treturn errors.New(\"max_body_size must be positive\")\n\t}\n\n\treturn nil\n}\n\n\nfunc (c *Configuration) Normalize() {\n\tif c.WebhookPath != \"\" && c.WebhookPath[0] != '/' {\n\t\tc.WebhookPath = \"/\" + c.WebhookPath\n\t}\n}\n\nfunc (s *Source) Configure(_ context.Context, config []byte, logger *log.Entry, metricsLevel metrics.AcquisitionMetricsLevel) error {\n\ts.logger = logger","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/kubernetesaudit/config.go#L58-L94","documentation":"The kubernetesaudit source serves audit events at a specific HTTP endpoint path; Configuration.Validate() requires WebhookPath to be non-empty so the server can register the handler route that the Kubernetes audit sink POSTs to.","triggerScenarios":"Calling Validate() on a kubernetesaudit Configuration where WebhookPath is the empty string — a YAML config missing the `webhook_path:` key.","commonSituations":"Users set address/port but assume a default path exists; or a config fragment copied without the path key. The path must also match the `path` in the API server's webhook audit sink config.","solutions":["Set webhook_path in the acquisition YAML, e.g. webhook_path: /audit or /kubernetes-audit.","Use the same path in the Kubernetes API server audit webhook backend configuration (path field of the webhook config).","Keep max_body_size positive if set, to pass the remaining validation checks."],"exampleFix":"// before (yaml)\nsource: kubernetesaudit\nlisten_addr: 0.0.0.0\nlisten_port: 8080\n\n// after (yaml)\nsource: kubernetesaudit\nlisten_addr: 0.0.0.0\nlisten_port: 8080\nwebhook_path: /audit","handlingStrategy":"validation","validationCode":"if cfg.WebhookPath == \"\" {\n    return fmt.Errorf(\"kubernetesaudit: webhook_path is required\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep webhook_path identical to the `path` in the Kubernetes audit webhook backend config.","Use a distinctive path (e.g. /kubernetes-audit) and secure the endpoint with TLS/mTLS.","Validate the whole kubernetesaudit config (addr, port, path) as one unit before deploy."],"tags":["kubernetes","audit","config-validation","webhook"],"backgroundTag":"missing-required-config-field","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}