Skip to content

Commit 7711901

Browse files
authored
Merge pull request #17 from hazcod/work/commandbot
Feature: skip findings without mitigations and holiday skipper
2 parents 53829cf + 3958a70 commit 7711901

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ slack:
3131
security_user: "[email protected]"
3232
# skip sending a security overview if there is nothing to mention
3333
skip_no_report: true
34+
# don't send a message to the user if 'Vacationing' status is set
35+
skip_on_holiday: true
3436

3537
# falcon crowdstrike
3638
falcon:

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func main() {
9292
continue
9393
}
9494

95-
if strings.EqualFold(slackUser.Profile.StatusText, slackStatusHoliday) {
95+
if config.Slack.SkipOnHoliday && strings.EqualFold(slackUser.Profile.StatusText, slackStatusHoliday) {
9696
logrus.WithField("slack_name", slackUser.Name).Warn("skipping user since he/she is on holiday")
9797
continue
9898
}

config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type Config struct {
1818
SecurityUser string `yaml:"security_user" emv:"SLACK_SECURITY_USER"`
1919

2020
SkipNoReport bool `yaml:"skip_no_report" env:"SLACK_SKIP_NO_REPORT"`
21+
SkipOnHoliday bool `yaml:"skip_on_holiday" env:"SLACK_SKIP_ON_HOLIDAY"`
2122
} `yaml:"slack"`
2223

2324
Falcon struct {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/hazcod/crowdstrike-spotlight-slacker
33
go 1.16
44

55
require (
6-
github.com/crowdstrike/gofalcon v0.2.6
6+
github.com/crowdstrike/gofalcon v0.2.7
77
github.com/kelseyhightower/envconfig v1.4.0
88
github.com/pkg/errors v0.9.1
99
github.com/sirupsen/logrus v1.8.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn
5454
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
5555
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
5656
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
57-
github.com/crowdstrike/gofalcon v0.2.6 h1:WRZV6stnbfVKYwfDOUmGZp92lT0FkkQLxFpSlriins0=
58-
github.com/crowdstrike/gofalcon v0.2.6/go.mod h1:tM+/b9HnHhJxysZmpn2ZXDfv1F4r4VSp6tFdCao/3Gw=
57+
github.com/crowdstrike/gofalcon v0.2.7 h1:aijfM6rg3Y+baE0DIk8F2bAMfieG7BPn2o3vNtVsUY4=
58+
github.com/crowdstrike/gofalcon v0.2.7/go.mod h1:tM+/b9HnHhJxysZmpn2ZXDfv1F4r4VSp6tFdCao/3Gw=
5959
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
6060
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
6161
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

pkg/falcon/extractor.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func GetMessages(config *config.Config, ctx context.Context) (results map[string
114114

115115
queryResult, err := client.SpotlightVulnerabilities.QueryVulnerabilities(
116116
&spotlight_vulnerabilities.QueryVulnerabilitiesParams{
117-
Context: context.Background(),
117+
Context: ctx,
118118
Filter: "status:'open',remediation.ids:'*'",
119119
Limit: &falconAPIMaxRecords,
120120
},
@@ -197,10 +197,17 @@ func GetMessages(config *config.Config, ctx context.Context) (results map[string
197197
ProductName: *vuln.App.ProductNameVersion,
198198
CveID: *vuln.Cve.ID,
199199
CveSeverity: *vuln.Cve.Severity,
200-
MitigationAvailable: true,
200+
MitigationAvailable: len(vuln.Remediation.Ids) > 0,
201201
TimestampFound: *vuln.CreatedTimestamp,
202202
}
203203

204+
if !deviceFinding.MitigationAvailable {
205+
logrus.WithField("cve",*vuln.Cve.ID).WithField("severity", *vuln.Cve.Severity).
206+
WithField("product", *vuln.App.ProductNameVersion).
207+
Warn("skipping finding without mitigation(s)")
208+
continue
209+
}
210+
204211
if _, ok := devices[uniqueDeviceID]; !ok {
205212
devices[uniqueDeviceID] = UserDevice{
206213
MachineName: fmt.Sprintf(

0 commit comments

Comments
 (0)