From ada28beb6afb45254e2e111386b79d6ca0147bba Mon Sep 17 00:00:00 2001 From: hazcod Date: Fri, 20 Aug 2021 10:33:53 +0200 Subject: [PATCH] fix: fix domain check --- pkg/falcon/extractor.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/falcon/extractor.go b/pkg/falcon/extractor.go index 82bd8da..4bd614a 100644 --- a/pkg/falcon/extractor.go +++ b/pkg/falcon/extractor.go @@ -73,11 +73,13 @@ func findEmailTag(tags []string, emailDomains []string) (email string, err error domainFound := false for _, domain := range emailDomains { - if ! strings.Contains(email, strings.ToLower(domain)) { + encodedDomain := strings.ToLower(strings.ReplaceAll(domain, ".", "/")) + + if ! strings.HasSuffix(email, encodedDomain) { continue } - email = strings.Replace(email, fmt.Sprintf("/%s", domain), fmt.Sprintf("@%s", domain), 1) + email = strings.Replace(email, fmt.Sprintf("/%s", encodedDomain), fmt.Sprintf("@%s", domain), 1) email = strings.ReplaceAll(email, "/", ".") domainFound = true @@ -134,7 +136,7 @@ func GetMessages(config *config.Config, ctx context.Context) (results map[string queryResult, err := client.SpotlightVulnerabilities.QueryVulnerabilities( &spotlight_vulnerabilities.QueryVulnerabilitiesParams{ Context: ctx, - Filter: "status:'open',remediation.ids:'*'", + Filter: "status:'open'", Limit: &falconAPIMaxRecords, }, )