Skip to content

Commit 3644432

Browse files
deprecate config file ignoring (#180)
* degrecate config file ignoring * wip * tidy * wip * wip
1 parent 787c21e commit 3644432

28 files changed

+21
-1149
lines changed

.github/workflows/ci-go.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ jobs:
2121
run: |
2222
go mod tidy
2323
git diff --exit-code
24-
- name: lint
25-
run: make lint-go
24+
- name: golangci-lint
25+
uses: golangci/golangci-lint-action@v8
26+
with:
27+
version: v2.4.0
28+
args: ./cmd/... ./pkg/... ./tests/...
2629
- name: test
2730
run: make unit

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ cov:
2020
lint: lint-go lint-docker
2121

2222
lint-go:
23-
docker build --quiet --target golangci-lint -t golangci-lint:latest .
24-
docker run --rm -v $(shell pwd):/app -w /app golangci-lint golangci-lint run ./...
23+
golangci-lint run ./cmd/... ./pkg/... ./tests/...
2524

2625
lint-docker:
2726
docker build --quiet --target hadolint -t hadolint:latest .

examples/nullify.yaml

Lines changed: 1 addition & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -6,94 +6,17 @@ 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
50-
code:
51-
auto_fix:
52-
enabled: true
53-
max_pull_requests_open: 2
54-
max_pull_request_creation_rate:
55-
count: 1
56-
days: 1
57-
ignore:
58-
- cwes: [ 589 ] # Potential HTTP request made with variable url
59-
reason: HTTP requests with variables in tests don't matter
60-
paths: [ "**/tests/*" ]
61-
repositories:
62-
- config-file-parser
63-
- dast-action
64-
- cli
65-
- rule_ids: [ python-sql-injection ]
66-
reason: This code won't be going live until next year but we should fix it before then
67-
expiry: "2021-12-31"
68-
dependencies:
69-
auto_fix:
70-
enabled: true
71-
max_pull_requests_open: 2
72-
max_pull_request_creation_rate:
73-
count: 1
74-
days: 1
75-
ignore:
76-
- cves: [ CVE-2021-1234 ]
77-
reason: This is a false positive
78-
expiry: "2021-12-31"
79-
- cves: [ CVE-2021-5678 ]
80-
reason: This isn't exploitable in client applications
81-
expiry: "2021-12-31"
82-
repositories:
83-
- dast-action
84-
- cli
859
secrets:
8610
ignore:
8711
- value: mocksecret123
8812
reason: This is a test secret, it has no access to anything
89-
paths: [ "**/tests/*" ]
9013
- pattern: id[0-9]+
9114
reason: These are not secrets, they are internal identifiers
9215
- value: actualsecret123
9316
reason: We can't remove this right now but we should
9417
expiry: "2021-12-31"
9518
- sha256: 87cbebfeebc05f7c54ac9336c4b4bbec831227a641951a4bde7edd56020f8590 # this is correct-horse-battery-staple
96-
reason: This was allowlisted from the Nullify dashboard
19+
reason: This was ignored from the Nullify dashboard
9720
integrations:
9821
jira:
9922
disabled: true

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ require (
2020
require (
2121
github.com/davecgh/go-spew v1.1.1 // indirect
2222
github.com/pmezard/go-difflib v1.0.0 // indirect
23-
github.com/robfig/cron/v3 v3.0.1
2423
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b
2524
)

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
1616
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
1717
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1818
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
19-
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
20-
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
2119
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
2220
github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg=
2321
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=

pkg/merger/merger.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,10 @@ func MergeConfigFiles(
104104
config.IgnorePaths = extraConfig.IgnorePaths
105105
}
106106

107-
if extraConfig.Code.AutoFix != nil {
108-
config.Code.AutoFix = extraConfig.Code.AutoFix
109-
}
110-
111107
if len(extraConfig.Code.Ignore) > 0 {
112108
config.Code.Ignore = extraConfig.Code.Ignore
113109
}
114110

115-
if extraConfig.Dependencies.AutoFix != nil {
116-
config.Dependencies.AutoFix = extraConfig.Dependencies.AutoFix
117-
}
118-
119111
if len(extraConfig.Dependencies.Ignore) > 0 {
120112
config.Dependencies.Ignore = extraConfig.Dependencies.Ignore
121113
}
@@ -142,21 +134,6 @@ func MergeConfigFiles(
142134
}
143135
}
144136

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-
}
160137
}
161138

162139
return &config

pkg/merger/merger_test.go

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,13 @@ func TestMergeConfigFiles(t *testing.T) {
3434
IgnoreDirs: []string{"dir1", "dir2"},
3535
IgnorePaths: []string{"path1", "path2"},
3636
Code: models.Code{
37-
AutoFix: &models.AutoFix{
38-
Enabled: true,
39-
},
4037
Ignore: []models.CodeIgnore{
4138
{
4239
CWEs: []int{123},
4340
},
4441
},
4542
},
4643
Dependencies: models.Dependencies{
47-
AutoFix: &models.AutoFix{
48-
Enabled: true,
49-
},
5044
Ignore: []models.DependenciesIgnore{
5145
{
5246
CVEs: []string{"CVE-2021-1234"},
@@ -60,20 +54,6 @@ func TestMergeConfigFiles(t *testing.T) {
6054
},
6155
},
6256
},
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-
},
7757
Integrations: models.Integrations{
7858
Jira: &models.Jira{
7959
ProjectKey: "JIRINT",
@@ -92,19 +72,13 @@ func TestMergeConfigFiles(t *testing.T) {
9272
IgnoreDirs: []string{"dir1", "dir2"},
9373
IgnorePaths: []string{"path1", "path2"},
9474
Code: models.Code{
95-
AutoFix: &models.AutoFix{
96-
Enabled: true,
97-
},
9875
Ignore: []models.CodeIgnore{
9976
{
10077
CWEs: []int{123},
10178
},
10279
},
10380
},
10481
Dependencies: models.Dependencies{
105-
AutoFix: &models.AutoFix{
106-
Enabled: true,
107-
},
10882
Ignore: []models.DependenciesIgnore{
10983
{
11084
CVEs: []string{"CVE-2021-1234"},
@@ -118,20 +92,6 @@ func TestMergeConfigFiles(t *testing.T) {
11892
},
11993
},
12094
},
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-
},
13595
Integrations: models.Integrations{
13696
Jira: &models.Jira{
13797
ProjectKey: "JIRINT",
@@ -150,19 +110,13 @@ func TestMergeConfigFiles(t *testing.T) {
150110
IgnoreDirs: []string{"dir1", "dir2"},
151111
IgnorePaths: []string{"path1", "path2"},
152112
Code: models.Code{
153-
AutoFix: &models.AutoFix{
154-
Enabled: true,
155-
},
156113
Ignore: []models.CodeIgnore{
157114
{
158115
CWEs: []int{123},
159116
},
160117
},
161118
},
162119
Dependencies: models.Dependencies{
163-
AutoFix: &models.AutoFix{
164-
Enabled: true,
165-
},
166120
Ignore: []models.DependenciesIgnore{
167121
{
168122
CVEs: []string{"CVE-2021-1234"},
@@ -176,20 +130,6 @@ func TestMergeConfigFiles(t *testing.T) {
176130
},
177131
},
178132
},
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-
},
193133
Integrations: models.Integrations{
194134
Jira: &models.Jira{
195135
ProjectKey: "JIRINT",
@@ -215,19 +155,13 @@ func TestMergeConfigFiles(t *testing.T) {
215155
IgnoreDirs: []string{"dir1", "dir2"},
216156
IgnorePaths: []string{"path1", "path2"},
217157
Code: models.Code{
218-
AutoFix: &models.AutoFix{
219-
Enabled: true,
220-
},
221158
Ignore: []models.CodeIgnore{
222159
{
223160
CWEs: []int{123},
224161
},
225162
},
226163
},
227164
Dependencies: models.Dependencies{
228-
AutoFix: &models.AutoFix{
229-
Enabled: true,
230-
},
231165
Ignore: []models.DependenciesIgnore{
232166
{
233167
CVEs: []string{"CVE-2021-1234"},
@@ -241,20 +175,6 @@ func TestMergeConfigFiles(t *testing.T) {
241175
},
242176
},
243177
},
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-
},
258178
Integrations: models.Integrations{
259179
Jira: &models.Jira{
260180
ProjectKey: "JIRINT",

pkg/models/autofix.go

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

pkg/models/code.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package models
22

33
type Code struct {
44
EnableFailBuilds *bool `yaml:"enable_fail_builds,omitempty"`
5-
AutoFix *AutoFix `yaml:"auto_fix,omitempty"`
65
Ignore []CodeIgnore `yaml:"ignore,omitempty"`
76
}
87

@@ -14,8 +13,10 @@ type CodeIgnore struct {
1413
CWEs []int `yaml:"cwes,omitempty"`
1514
RuleIDs []string `yaml:"rule_ids,omitempty"`
1615
Dirs []string `yaml:"dirs,omitempty"`
17-
Paths []string `yaml:"paths,omitempty"`
1816

1917
// global config only
2018
Repositories []string `yaml:"repositories,omitempty"`
19+
20+
// TODO deprecate
21+
Paths []string `yaml:"paths,omitempty"`
2122
}

pkg/models/dependencies.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package models
22

33
type Dependencies struct {
44
EnableFailBuilds *bool `yaml:"enable_fail_builds,omitempty"`
5-
AutoFix *AutoFix `yaml:"auto_fix,omitempty"`
65
Ignore []DependenciesIgnore `yaml:"ignore,omitempty"`
76
}
87

@@ -11,10 +10,12 @@ type DependenciesIgnore struct {
1110
Expiry string `yaml:"expiry,omitempty"`
1211

1312
// matchers
14-
CVEs []string `yaml:"cves,omitempty"`
15-
Dirs []string `yaml:"dirs,omitempty"`
16-
Paths []string `yaml:"paths,omitempty"`
13+
CVEs []string `yaml:"cves,omitempty"`
14+
Dirs []string `yaml:"dirs,omitempty"`
1715

1816
// global config only
1917
Repositories []string `yaml:"repositories,omitempty"`
18+
19+
// TODO deprecate
20+
Paths []string `yaml:"paths,omitempty"`
2021
}

0 commit comments

Comments
 (0)