Skip to content

Commit 8754ab1

Browse files
wip
1 parent 3ab6c7f commit 8754ab1

18 files changed

+2
-837
lines changed

examples/nullify.yaml

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,6 @@ ignore_dirs:
66
- dir1
77
ignore_paths:
88
- data/**/*
9-
notifications:
10-
all-events-webhook:
11-
events:
12-
all:
13-
minimum_severity: high
14-
secret_types: [ ssh_key ]
15-
targets:
16-
webhook:
17-
urls: [ https://webhook.site/123456 ]
18-
findings-to-slack-and-email:
19-
events:
20-
new_code_findings:
21-
minimum_severity: high
22-
new_secret_findings:
23-
types: [ ssh_key ]
24-
new_dependency_findings:
25-
minimum_severity: high
26-
targets:
27-
slack:
28-
channels: [ "123456" ]
29-
email:
30-
31-
repositories:
32-
- config-file-parser
33-
- dast-action
34-
- cli
35-
scheduled_notifications:
36-
new-findings:
37-
schedule: "0 0 * * *"
38-
timezone: "America/Los_Angeles"
39-
topics:
40-
all: true
41-
targets:
42-
slack:
43-
channels: [ "123456" ]
44-
email:
45-
46-
repositories:
47-
- config-file-parser
48-
- dast-action
49-
- cli
509
secrets:
5110
ignore:
5211
- value: mocksecret123

pkg/merger/merger.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -142,21 +142,6 @@ func MergeConfigFiles(
142142
}
143143
}
144144

145-
if len(extraConfig.Notifications) > 0 && config.Notifications == nil {
146-
config.Notifications = map[string]models.Notification{}
147-
}
148-
149-
for k, v := range extraConfig.Notifications {
150-
config.Notifications[k] = v
151-
}
152-
153-
if len(extraConfig.ScheduledNotifications) > 0 && config.ScheduledNotifications == nil {
154-
config.ScheduledNotifications = extraConfig.ScheduledNotifications
155-
}
156-
157-
for k, v := range extraConfig.ScheduledNotifications {
158-
config.ScheduledNotifications[k] = v
159-
}
160145
}
161146

162147
return &config

pkg/merger/merger_test.go

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,6 @@ func TestMergeConfigFiles(t *testing.T) {
6060
},
6161
},
6262
},
63-
Notifications: map[string]models.Notification{
64-
"slack": {
65-
Events: models.NotificationEvents{
66-
All: &models.NotificationEventAll{
67-
MinimumSeverity: models.SeverityHigh,
68-
},
69-
},
70-
},
71-
},
72-
ScheduledNotifications: map[string]models.ScheduledNotification{
73-
"slack": {
74-
Schedule: "0 0 * * *",
75-
},
76-
},
7763
Integrations: models.Integrations{
7864
Jira: &models.Jira{
7965
ProjectKey: "JIRINT",
@@ -118,20 +104,6 @@ func TestMergeConfigFiles(t *testing.T) {
118104
},
119105
},
120106
},
121-
Notifications: map[string]models.Notification{
122-
"slack": {
123-
Events: models.NotificationEvents{
124-
All: &models.NotificationEventAll{
125-
MinimumSeverity: models.SeverityHigh,
126-
},
127-
},
128-
},
129-
},
130-
ScheduledNotifications: map[string]models.ScheduledNotification{
131-
"slack": {
132-
Schedule: "0 0 * * *",
133-
},
134-
},
135107
Integrations: models.Integrations{
136108
Jira: &models.Jira{
137109
ProjectKey: "JIRINT",
@@ -176,20 +148,6 @@ func TestMergeConfigFiles(t *testing.T) {
176148
},
177149
},
178150
},
179-
Notifications: map[string]models.Notification{
180-
"slack": {
181-
Events: models.NotificationEvents{
182-
All: &models.NotificationEventAll{
183-
MinimumSeverity: models.SeverityHigh,
184-
},
185-
},
186-
},
187-
},
188-
ScheduledNotifications: map[string]models.ScheduledNotification{
189-
"slack": {
190-
Schedule: "0 0 * * *",
191-
},
192-
},
193151
Integrations: models.Integrations{
194152
Jira: &models.Jira{
195153
ProjectKey: "JIRINT",
@@ -241,20 +199,6 @@ func TestMergeConfigFiles(t *testing.T) {
241199
},
242200
},
243201
},
244-
Notifications: map[string]models.Notification{
245-
"slack": {
246-
Events: models.NotificationEvents{
247-
All: &models.NotificationEventAll{
248-
MinimumSeverity: models.SeverityHigh,
249-
},
250-
},
251-
},
252-
},
253-
ScheduledNotifications: map[string]models.ScheduledNotification{
254-
"slack": {
255-
Schedule: "0 0 * * *",
256-
},
257-
},
258202
Integrations: models.Integrations{
259203
Jira: &models.Jira{
260204
ProjectKey: "JIRINT",

pkg/models/models.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ type Configuration struct {
1313
IgnorePaths []string `yaml:"ignore_paths,omitempty"`
1414
AutoFix *AutoFix `yaml:"auto_fix,omitempty"`
1515

16-
Notifications map[string]Notification `yaml:"notifications,omitempty"`
17-
ScheduledNotifications map[string]ScheduledNotification `yaml:"scheduled_notifications,omitempty"`
18-
Integrations Integrations `yaml:"integrations,omitempty"`
16+
Integrations Integrations `yaml:"integrations,omitempty"`
1917

2018
// features
2119
Code Code `yaml:"code"`

pkg/models/notifications.go

Lines changed: 0 additions & 9 deletions
This file was deleted.

pkg/models/notifications_events.go

Lines changed: 0 additions & 40 deletions
This file was deleted.

pkg/models/notifications_targets.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

pkg/models/scheduled_notifications.go

Lines changed: 0 additions & 45 deletions
This file was deleted.

pkg/parser/defaults.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ func NewDefaultConfig() *models.Configuration {
2323
Secrets: models.Secrets{
2424
Ignore: nil,
2525
},
26-
Notifications: nil,
27-
ScheduledNotifications: nil,
28-
Integrations: models.Integrations{},
26+
Integrations: models.Integrations{},
2927
}
3028
}

pkg/parser/parse.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,4 @@ func sanitizeConfig(config *models.Configuration) {
4141
}
4242
config.Integrations.Jira = j
4343
}
44-
45-
for name, n := range config.Notifications {
46-
if n.Events.All != nil {
47-
n.Events.All.MinimumSeverity = strings.ToUpper(n.Events.All.MinimumSeverity)
48-
}
49-
50-
if n.Events.NewAPIFindings != nil {
51-
n.Events.NewAPIFindings.MinimumSeverity = strings.ToUpper(n.Events.NewAPIFindings.MinimumSeverity)
52-
}
53-
54-
if n.Events.NewCodeFindings != nil {
55-
n.Events.NewCodeFindings.MinimumSeverity = strings.ToUpper(n.Events.NewCodeFindings.MinimumSeverity)
56-
}
57-
58-
if n.Events.NewDependencyFindings != nil {
59-
n.Events.NewDependencyFindings.MinimumSeverity = strings.ToUpper(n.Events.NewDependencyFindings.MinimumSeverity)
60-
}
61-
62-
config.Notifications[name] = n
63-
}
6444
}

0 commit comments

Comments
 (0)