From 688d32cc9f8006202e3a7ff6ef7d0e3ddb32fd61 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Fri, 10 Apr 2026 16:20:34 +0700 Subject: [PATCH] registry: reject checker registration with empty ID Prevent silent bugs where a CheckerDefinition with an unset ID would be registered under the empty string key, becoming unfindable and potentially colliding with other empty-ID registrations. --- checker/registry.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/checker/registry.go b/checker/registry.go index 2a8af85..e8f5d55 100644 --- a/checker/registry.go +++ b/checker/registry.go @@ -33,6 +33,10 @@ var observationProviderRegistry = map[ObservationKey]ObservationProvider{} // always indicates a deployment mistake (two plugins shipping the same // checker, or a plugin shadowing a built-in). func RegisterChecker(c *CheckerDefinition) { + if c.ID == "" { + log.Println("Warning: refusing to register checker with empty ID") + return + } if _, exists := checkerRegistry[c.ID]; exists { log.Printf("Warning: checker %q is already registered; ignoring duplicate registration", c.ID) return