Skip to content

Commit 3ab6c7f

Browse files
degrecate config file ignoring
1 parent 787c21e commit 3ab6c7f

File tree

8 files changed

+19
-167
lines changed

8 files changed

+19
-167
lines changed

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 & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -47,53 +47,17 @@ scheduled_notifications:
4747
- config-file-parser
4848
- dast-action
4949
- 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
8550
secrets:
8651
ignore:
8752
- value: mocksecret123
8853
reason: This is a test secret, it has no access to anything
89-
paths: [ "**/tests/*" ]
9054
- pattern: id[0-9]+
9155
reason: These are not secrets, they are internal identifiers
9256
- value: actualsecret123
9357
reason: We can't remove this right now but we should
9458
expiry: "2021-12-31"
9559
- sha256: 87cbebfeebc05f7c54ac9336c4b4bbec831227a641951a4bde7edd56020f8590 # this is correct-horse-battery-staple
96-
reason: This was allowlisted from the Nullify dashboard
60+
reason: This was ignored from the Nullify dashboard
9761
integrations:
9862
jira:
9963
disabled: true

pkg/models/code.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ 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"`
6+
7+
// TODO deprecate
8+
AutoFix *AutoFix `yaml:"auto_fix,omitempty"`
79
}
810

911
type CodeIgnore struct {
@@ -14,8 +16,10 @@ type CodeIgnore struct {
1416
CWEs []int `yaml:"cwes,omitempty"`
1517
RuleIDs []string `yaml:"rule_ids,omitempty"`
1618
Dirs []string `yaml:"dirs,omitempty"`
17-
Paths []string `yaml:"paths,omitempty"`
1819

1920
// global config only
2021
Repositories []string `yaml:"repositories,omitempty"`
22+
23+
// TODO deprecate
24+
Paths []string `yaml:"paths,omitempty"`
2125
}

pkg/models/dependencies.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@ 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"`
6+
7+
// TODO deprecate
8+
AutoFix *AutoFix `yaml:"auto_fix,omitempty"`
79
}
810

911
type DependenciesIgnore struct {
1012
Reason string `yaml:"reason,omitempty"`
1113
Expiry string `yaml:"expiry,omitempty"`
1214

1315
// matchers
14-
CVEs []string `yaml:"cves,omitempty"`
15-
Dirs []string `yaml:"dirs,omitempty"`
16-
Paths []string `yaml:"paths,omitempty"`
16+
CVEs []string `yaml:"cves,omitempty"`
17+
Dirs []string `yaml:"dirs,omitempty"`
1718

1819
// global config only
1920
Repositories []string `yaml:"repositories,omitempty"`
21+
22+
// TODO deprecate
23+
Paths []string `yaml:"paths,omitempty"`
2024
}

pkg/models/secrets.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ type SecretsIgnore struct {
1818

1919
// global config only
2020
Repositories []string `yaml:"repositories,omitempty"`
21+
22+
// TODO deprecate
23+
Paths []string `yaml:"paths,omitempty"`
2124
}
2225

2326
type SecretsCustomPattern struct {

tests/empty_fail_build.yaml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,10 @@ scheduled_notifications:
4343
- config-file-parser
4444
- dast-action
4545
- cli
46-
code:
47-
ignore:
48-
- cwes: [ 589 ] # Potential HTTP request made with variable url
49-
reason: HTTP requests with variables in tests don't matter
50-
paths: [ "**/tests/*" ]
51-
repositories:
52-
- config-file-parser
53-
- dast-action
54-
- cli
55-
- rule_ids: [ python-sql-injection ]
56-
reason: This code won't be going live until next year but we should fix it before then
57-
expiry: "2021-12-31"
58-
dependencies:
59-
ignore:
60-
- cves: [ CVE-2021-1234 ]
61-
reason: This is a false positive
62-
expiry: "2021-12-31"
63-
- cves: [ CVE-2021-5678 ]
64-
reason: This isn't exploitable in client applications
65-
expiry: "2021-12-31"
66-
repositories:
67-
- dast-action
68-
- cli
6946
secrets:
7047
ignore:
7148
- value: mocksecret123
7249
reason: This is a test secret, it has no access to anything
73-
paths: [ "**/tests/*" ]
7450
- pattern: id[0-9]+
7551
reason: These are not secrets, they are internal identifiers
7652
- value: actualsecret123

tests/integration_test.go

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -107,43 +107,6 @@ func TestIntegration(t *testing.T) {
107107
},
108108
},
109109
},
110-
Code: models.Code{
111-
Ignore: []models.CodeIgnore{
112-
{
113-
CWEs: []int{589},
114-
Reason: "HTTP requests with variables in tests don't matter",
115-
Paths: []string{"**/tests/*"},
116-
Repositories: []string{
117-
"config-file-parser",
118-
"dast-action",
119-
"cli",
120-
},
121-
},
122-
{
123-
RuleIDs: []string{"python-sql-injection"},
124-
Reason: "This code won't be going live until next year but we should fix it before then",
125-
Expiry: "2021-12-31",
126-
},
127-
},
128-
},
129-
Dependencies: models.Dependencies{
130-
Ignore: []models.DependenciesIgnore{
131-
{
132-
CVEs: []string{"CVE-2021-1234"},
133-
Reason: "This is a false positive",
134-
Expiry: "2021-12-31",
135-
},
136-
{
137-
CVEs: []string{"CVE-2021-5678"},
138-
Reason: "This isn't exploitable in client applications",
139-
Expiry: "2021-12-31",
140-
Repositories: []string{
141-
"dast-action",
142-
"cli",
143-
},
144-
},
145-
},
146-
},
147110
Integrations: models.Integrations{
148111
Jira: &models.Jira{
149112
Disabled: false,
@@ -248,43 +211,6 @@ func TestEmptyFailsBuildField(t *testing.T) {
248211
},
249212
},
250213
},
251-
Code: models.Code{
252-
Ignore: []models.CodeIgnore{
253-
{
254-
CWEs: []int{589},
255-
Reason: "HTTP requests with variables in tests don't matter",
256-
Paths: []string{"**/tests/*"},
257-
Repositories: []string{
258-
"config-file-parser",
259-
"dast-action",
260-
"cli",
261-
},
262-
},
263-
{
264-
RuleIDs: []string{"python-sql-injection"},
265-
Reason: "This code won't be going live until next year but we should fix it before then",
266-
Expiry: "2021-12-31",
267-
},
268-
},
269-
},
270-
Dependencies: models.Dependencies{
271-
Ignore: []models.DependenciesIgnore{
272-
{
273-
CVEs: []string{"CVE-2021-1234"},
274-
Reason: "This is a false positive",
275-
Expiry: "2021-12-31",
276-
},
277-
{
278-
CVEs: []string{"CVE-2021-5678"},
279-
Reason: "This isn't exploitable in client applications",
280-
Expiry: "2021-12-31",
281-
Repositories: []string{
282-
"dast-action",
283-
"cli",
284-
},
285-
},
286-
},
287-
},
288214
}
289215

290216
config, err := parser.LoadFromFile("empty_fail_build.yaml")

tests/nullify.yaml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,34 +47,10 @@ scheduled_notifications:
4747
- config-file-parser
4848
- dast-action
4949
- cli
50-
code:
51-
ignore:
52-
- cwes: [ 589 ] # Potential HTTP request made with variable url
53-
reason: HTTP requests with variables in tests don't matter
54-
paths: [ "**/tests/*" ]
55-
repositories:
56-
- config-file-parser
57-
- dast-action
58-
- cli
59-
- rule_ids: [ python-sql-injection ]
60-
reason: This code won't be going live until next year but we should fix it before then
61-
expiry: "2021-12-31"
62-
dependencies:
63-
ignore:
64-
- cves: [ CVE-2021-1234 ]
65-
reason: This is a false positive
66-
expiry: "2021-12-31"
67-
- cves: [ CVE-2021-5678 ]
68-
reason: This isn't exploitable in client applications
69-
expiry: "2021-12-31"
70-
repositories:
71-
- dast-action
72-
- cli
7350
secrets:
7451
ignore:
7552
- value: mocksecret123
7653
reason: This is a test secret, it has no access to anything
77-
paths: [ "**/tests/*" ]
7854
- pattern: id[0-9]+
7955
reason: These are not secrets, they are internal identifiers
8056
- value: actualsecret123

0 commit comments

Comments
 (0)