diff --git a/profile/profile-layered.go b/profile/profile-layered.go index 4228bf39..27b33843 100644 --- a/profile/profile-layered.go +++ b/profile/profile-layered.go @@ -324,8 +324,8 @@ func (lp *LayeredProfile) MatchFilterLists(ctx context.Context, entity *intel.En entity.EnableCNAMECheck(ctx, lp.FilterCNAMEs()) for _, layer := range lp.layers { - // search for the first layer that has filterListIDs set - if len(layer.filterListIDs) > 0 { + // Search for the first layer that has filter lists set. + if layer.filterListsSet { entity.LoadLists(ctx) if entity.MatchLists(layer.filterListIDs) { diff --git a/profile/profile.go b/profile/profile.go index aaf69304..497f9d9f 100644 --- a/profile/profile.go +++ b/profile/profile.go @@ -122,6 +122,7 @@ type Profile struct { //nolint:maligned // not worth the effort defaultAction uint8 endpoints endpoints.Endpoints serviceEndpoints endpoints.Endpoints + filterListsSet bool filterListIDs []string // Lifecycle Management @@ -152,6 +153,7 @@ func (profile *Profile) parseConfig() error { var lastErr error action, ok := profile.configPerspective.GetAsString(CfgOptionDefaultActionKey) + profile.defaultAction = DefaultActionNotSet if ok { switch action { case "permit": @@ -166,6 +168,7 @@ func (profile *Profile) parseConfig() error { } list, ok := profile.configPerspective.GetAsStringArray(CfgOptionEndpointsKey) + profile.endpoints = nil if ok { profile.endpoints, err = endpoints.ParseEndpoints(list) if err != nil { @@ -174,6 +177,7 @@ func (profile *Profile) parseConfig() error { } list, ok = profile.configPerspective.GetAsStringArray(CfgOptionServiceEndpointsKey) + profile.serviceEndpoints = nil if ok { profile.serviceEndpoints, err = endpoints.ParseEndpoints(list) if err != nil { @@ -182,10 +186,13 @@ func (profile *Profile) parseConfig() error { } list, ok = profile.configPerspective.GetAsStringArray(CfgOptionFilterListsKey) + profile.filterListsSet = false if ok { profile.filterListIDs, err = filterlists.ResolveListIDs(list) if err != nil { lastErr = err + } else { + profile.filterListsSet = true } }