From 7da79685fff9b34c30b3c6786ebf4b97b091daa1 Mon Sep 17 00:00:00 2001 From: Wade Simmons Date: Tue, 29 Jul 2025 13:12:07 -0400 Subject: [PATCH] fix lighthouse.calculated_remotes parsing (#1438) This was broken with the change to yaml.v3: - https://github.com/slackhq/nebula/pull/1148 We forgot to update these references to `map[string]any`. Without this fix, Nebula crashes with an error like this: {"error":"config `lighthouse.calculated_remotes` has invalid type: map[string]interface {}","level":"error","msg":"Invalid lighthouse.calculated_remotes","time":"2025-07-29T15:50:06.479499Z"} --- calculated_remote.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/calculated_remote.go b/calculated_remote.go index 32d062a..0e28bb4 100644 --- a/calculated_remote.go +++ b/calculated_remote.go @@ -84,16 +84,11 @@ func NewCalculatedRemotesFromConfig(c *config.C, k string) (*bart.Table[[]*calcu calculatedRemotes := new(bart.Table[[]*calculatedRemote]) - rawMap, ok := value.(map[any]any) + rawMap, ok := value.(map[string]any) if !ok { return nil, fmt.Errorf("config `%s` has invalid type: %T", k, value) } - for rawKey, rawValue := range rawMap { - rawCIDR, ok := rawKey.(string) - if !ok { - return nil, fmt.Errorf("config `%s` has invalid key (type %T): %v", k, rawKey, rawKey) - } - + for rawCIDR, rawValue := range rawMap { cidr, err := netip.ParsePrefix(rawCIDR) if err != nil { return nil, fmt.Errorf("config `%s` has invalid CIDR: %s", k, rawCIDR) @@ -129,7 +124,7 @@ func newCalculatedRemotesListFromConfig(cidr netip.Prefix, raw any) ([]*calculat } func newCalculatedRemotesEntryFromConfig(cidr netip.Prefix, raw any) (*calculatedRemote, error) { - rawMap, ok := raw.(map[any]any) + rawMap, ok := raw.(map[string]any) if !ok { return nil, fmt.Errorf("invalid type: %T", raw) }