From 6c849ab607e6478f96a50e5022f32bfc152f9dff Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 23 Aug 2021 23:29:00 +0200 Subject: [PATCH] Fix intel fetching input validation, improve logging --- intel/entity.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/intel/entity.go b/intel/entity.go index ff9c1554..2e93597b 100644 --- a/intel/entity.go +++ b/intel/entity.go @@ -317,14 +317,13 @@ func (e *Entity) getDomainLists(ctx context.Context) { e.loadDomainListOnce.Do(func() { var domainsToInspect = []string{domain} - if e.checkCNAMEs { + if e.checkCNAMEs && len(e.CNAME) > 0 { log.Tracer(ctx).Tracef("intel: CNAME filtering enabled, checking %v too", e.CNAME) domainsToInspect = append(domainsToInspect, e.CNAME...) } var domains []string if e.resolveSubDomainLists { - log.Tracer(ctx).Trace("intel: subdomain filtering enabled, checking all subdomains too") for _, domain := range domainsToInspect { subdomains := splitDomain(domain) domains = append(domains, subdomains...) @@ -381,7 +380,7 @@ func (e *Entity) getASNLists(ctx context.Context) { } asn, ok := e.GetASN(ctx) - if !ok { + if !ok || asn == 0 { return } @@ -406,7 +405,7 @@ func (e *Entity) getCountryLists(ctx context.Context) { } country, ok := e.GetCountry(ctx) - if !ok { + if !ok || country == "" { return } @@ -430,11 +429,7 @@ func (e *Entity) getIPLists(ctx context.Context) { } ip, ok := e.GetIP() - if !ok { - return - } - - if ip == nil { + if !ok || ip == nil { return }