Skip to content

Commit 68b8553

Browse files
add global only repository list for all relevant settings (#55)
* add global only repository list for all relevant settings * update examples
1 parent 20aed19 commit 68b8553

File tree

9 files changed

+86
-12
lines changed

9 files changed

+86
-12
lines changed

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
func main() {
11-
config, err := parser.LoadFromFile("data/nullify.yaml")
11+
config, err := parser.LoadFromFile("examples/nullify.yaml")
1212
if err != nil {
1313
panic(err)
1414
}
Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
severity_threshold: medium
22
ignore_dirs:
3-
- data
3+
- dir1
44
ignore_paths:
55
- data/**/*
66
notifications:
77
all-events-webhook:
88
events:
99
all:
1010
minimum_severity: high
11-
secret_types: [ssh_key]
11+
secret_types: [ ssh_key ]
1212
targets:
1313
webhook:
1414
urls: [ https://webhook.site/123456 ]
@@ -17,30 +17,41 @@ notifications:
1717
new_code_findings:
1818
minimum_severity: high
1919
new_secret_findings:
20-
types: [ssh_key]
20+
types: [ ssh_key ]
2121
new_dependency_findings:
2222
minimum_severity: high
2323
targets:
2424
slack:
2525
channels: [ "123456" ]
2626
email:
27-
27+
28+
repositories:
29+
- config-file-parser
30+
- dast-action
31+
- cli
2832
scheduled_notifications:
2933
new-findings:
30-
schedule: "* * * * *"
34+
schedule: "0 0 * * *"
3135
topics:
3236
all: true
3337
targets:
34-
email:
35-
addresses:
36-
3738
slack:
38-
channel: "123456"
39+
channels: [ "123456" ]
40+
email:
41+
42+
repositories:
43+
- config-file-parser
44+
- dast-action
45+
- cli
3946
code:
4047
ignore:
4148
- cwes: [ 589 ] # Potential HTTP request made with variable url
4249
reason: HTTP requests with variables in tests don't matter
43-
paths: "**/tests/*"
50+
paths: [ "**/tests/*" ]
51+
repositories:
52+
- config-file-parser
53+
- dast-action
54+
- cli
4455
- rule_ids: [ python-sql-injection ]
4556
reason: This code won't be going live until next year but we should fix it before then
4657
expiry: "2021-12-31"
@@ -49,6 +60,12 @@ dependencies:
4960
- cve: CVE-2021-1234
5061
reason: This is a false positive
5162
expiry: "2021-12-31"
63+
- cve: CVE-2021-5678
64+
reason: This isn't exploitable in client applications
65+
expiry: "2021-12-31"
66+
repositories:
67+
- dast-action
68+
- cli
5269
secrets:
5370
ignore:
5471
- value: mocksecret123

pkg/models/code.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ type CodeIgnore struct {
1111
Dirs []string `yaml:"dirs,omitempty"`
1212
Paths []string `yaml:"paths,omitempty"`
1313
Expiry string `yaml:"expiry,omitempty"`
14+
15+
// global config only
16+
Repositories []string `yaml:"repositories,omitempty"`
1417
}

pkg/models/dependencies.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ type DependenciesIgnore struct {
1010
Expiry string `yaml:"expiry,omitempty"`
1111
Dirs []string `yaml:"dirs,omitempty"`
1212
Paths []string `yaml:"paths,omitempty"`
13+
14+
// global config only
15+
Repositories []string `yaml:"repositories,omitempty"`
1316
}

pkg/models/notifications.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ package models
33
type Notification struct {
44
Events NotificationEvents `yaml:"events,omitempty"`
55
Targets NotificationTargets `yaml:"targets,omitempty"`
6+
7+
// global config only
8+
Repositories []string `yaml:"repositories,omitempty"`
69
}

pkg/models/scheduled_notifications.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ type ScheduledNotification struct {
1313
Schedule string `yaml:"schedule,omitempty"`
1414
Topics ScheduledNotificationTopics `yaml:"topics,omitempty"`
1515
Targets ScheduledNotificationTargets `yaml:"targets,omitempty"`
16+
17+
// global config only
18+
Repositories []string `yaml:"repositories,omitempty"`
1619
}
1720

1821
type ScheduledNotificationTopics struct {

pkg/models/secrets.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ type SecretsIgnore struct {
1111
Expiry string `yaml:"expiry,omitempty"`
1212
Dirs []string `yaml:"dirs,omitempty"`
1313
Paths []string `yaml:"paths,omitempty"`
14+
15+
// global config only
16+
Repositories []string `yaml:"repositories,omitempty"`
1417
}

tests/integration_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ func TestIntegration(t *testing.T) {
6565
Addresses: []string{"[email protected]", "[email protected]"},
6666
},
6767
},
68+
Repositories: []string{
69+
"config-file-parser",
70+
"dast-action",
71+
"cli",
72+
},
6873
},
6974
},
7075
ScheduledNotifications: map[string]models.ScheduledNotification{
@@ -81,6 +86,11 @@ func TestIntegration(t *testing.T) {
8186
Channels: []string{"123456"},
8287
},
8388
},
89+
Repositories: []string{
90+
"config-file-parser",
91+
"dast-action",
92+
"cli",
93+
},
8494
},
8595
},
8696
Code: models.Code{
@@ -89,6 +99,11 @@ func TestIntegration(t *testing.T) {
8999
CWEs: []int{589},
90100
Reason: "HTTP requests with variables in tests don't matter",
91101
Paths: []string{"**/tests/*"},
102+
Repositories: []string{
103+
"config-file-parser",
104+
"dast-action",
105+
"cli",
106+
},
92107
},
93108
{
94109
RuleIDs: []string{"python-sql-injection"},
@@ -104,6 +119,15 @@ func TestIntegration(t *testing.T) {
104119
Reason: "This is a false positive",
105120
Expiry: "2021-12-31",
106121
},
122+
{
123+
CVE: "CVE-2021-5678",
124+
Reason: "This isn't exploitable in client applications",
125+
Expiry: "2021-12-31",
126+
Repositories: []string{
127+
"dast-action",
128+
"cli",
129+
},
130+
},
107131
},
108132
},
109133
}

tests/nullify.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ notifications:
88
events:
99
all:
1010
minimum_severity: high
11-
secret_types: [ssh_key]
11+
secret_types: [ ssh_key ]
1212
targets:
1313
webhook:
1414
urls: [ https://webhook.site/123456 ]
@@ -25,6 +25,10 @@ notifications:
2525
channels: [ "123456" ]
2626
email:
2727
28+
repositories:
29+
- config-file-parser
30+
- dast-action
31+
- cli
2832
scheduled_notifications:
2933
new-findings:
3034
schedule: "0 0 * * *"
@@ -35,11 +39,19 @@ scheduled_notifications:
3539
channels: [ "123456" ]
3640
email:
3741
42+
repositories:
43+
- config-file-parser
44+
- dast-action
45+
- cli
3846
code:
3947
ignore:
4048
- cwes: [ 589 ] # Potential HTTP request made with variable url
4149
reason: HTTP requests with variables in tests don't matter
4250
paths: [ "**/tests/*" ]
51+
repositories:
52+
- config-file-parser
53+
- dast-action
54+
- cli
4355
- rule_ids: [ python-sql-injection ]
4456
reason: This code won't be going live until next year but we should fix it before then
4557
expiry: "2021-12-31"
@@ -48,6 +60,12 @@ dependencies:
4860
- cve: CVE-2021-1234
4961
reason: This is a false positive
5062
expiry: "2021-12-31"
63+
- cve: CVE-2021-5678
64+
reason: This isn't exploitable in client applications
65+
expiry: "2021-12-31"
66+
repositories:
67+
- dast-action
68+
- cli
5169
secrets:
5270
ignore:
5371
- value: mocksecret123

0 commit comments

Comments
 (0)