@@ -97,6 +97,25 @@ func findEmailTag(tags []string, emailDomains []string) (email string, err error
9797 return email , nil
9898}
9999
100+ func appendUnique (main , adder []string ) []string {
101+ for i := range adder {
102+ found := false
103+
104+ for j := range main {
105+ if strings .EqualFold (adder [i ], main [j ]) {
106+ found = true
107+ break
108+ }
109+ }
110+
111+ if found { continue }
112+
113+ main = append (main , adder [i ])
114+ }
115+
116+ return main
117+ }
118+
100119func GetMessages (config * config.Config , ctx context.Context ) (results map [string ]FalconResult , err error ) {
101120 falconAPIMaxRecords := int64 (400 )
102121
@@ -181,7 +200,9 @@ func GetMessages(config *config.Config, ctx context.Context) (results map[string
181200
182201 for _ , sev := range config .Falcon .SkipSeverities {
183202 if strings .EqualFold (sev , vulnSev ) {
184- logrus .WithField ("severity" , * vuln .Cve .Severity ).Debug ("skipping vulnerability" )
203+ logrus .WithField ("host" , * vuln .HostInfo .Hostname ).WithField ("cve_score" , * vuln .Cve .BaseScore ).
204+ WithField ("severity" , * vuln .Cve .Severity ).WithField ("cve" , * vuln .Cve .ID ).
205+ Debug ("skipping vulnerability" )
185206 skip = true
186207 break
187208 }
@@ -190,7 +211,8 @@ func GetMessages(config *config.Config, ctx context.Context) (results map[string
190211 if skip { continue }
191212 }
192213
193- logrus .WithField ("cve_score" , * vuln .Cve .BaseScore ).WithField ("severity" , * vuln .Cve .Severity ).
214+ logrus .WithField ("host" , * vuln .HostInfo .Hostname ).WithField ("cve_score" , * vuln .Cve .BaseScore ).
215+ WithField ("severity" , * vuln .Cve .Severity ).WithField ("cve" , * vuln .Cve .ID ).
194216 Debug ("adding vulnerability" )
195217
196218 deviceFinding := UserDeviceFinding {
@@ -235,7 +257,7 @@ func GetMessages(config *config.Config, ctx context.Context) (results map[string
235257 device .Findings = append (device .Findings , deviceFinding )
236258 }
237259
238- device .Tags = append (device .Tags , vuln .HostInfo .Tags ... )
260+ device .Tags = appendUnique (device .Tags , vuln .HostInfo .Tags )
239261
240262 devices [uniqueDeviceID ] = device
241263
@@ -260,7 +282,7 @@ func GetMessages(config *config.Config, ctx context.Context) (results map[string
260282 WithField ("tags" , device .Tags ).
261283 WithField ("prefix" , tagEmailPrefix ).
262284 WithField ("device" , device .MachineName ).
263- Warn ("could extract user email tag, using fallback Slack user " )
285+ Warn ("could not extract Falcon email tag from host , using fallback" )
264286
265287 userEmail = config .Slack .SecurityUser
266288 }
@@ -278,7 +300,5 @@ func GetMessages(config *config.Config, ctx context.Context) (results map[string
278300 results [userEmail ] = user
279301 }
280302
281- logrus .Debugf ("%+v" , results )
282-
283303 return results , nil
284304}
0 commit comments