Skip to content

Commit 07bdb81

Browse files
authored
Fix bug with default config (#70)
When no nightfall dlp config file was provided, the module was sending a bad default request payload
1 parent 92a6b9a commit 07bdb81

File tree

6 files changed

+21
-5
lines changed

6 files changed

+21
-5
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2.1
22

33
orbs:
4-
nightfall_code_scanner: nightfall/nightfall_code_scanner@2.2.0
4+
nightfall_code_scanner: nightfall/nightfall_code_scanner@3.0.0
55

66
jobs:
77
build:

.nightfalldlp/config.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,38 @@
55
"detectors": [
66
{
77
"minNumFindings": 1,
8-
"minConfidence": "VERY_UNLIKELY",
8+
"minConfidence": "LIKELY",
99
"displayName": "cc num",
1010
"detectorType": "NIGHTFALL_DETECTOR",
1111
"nightfallDetector": "CREDIT_CARD_NUMBER"
1212
},
1313
{
1414
"minNumFindings": 1,
15-
"minConfidence": "VERY_UNLIKELY",
15+
"minConfidence": "LIKELY",
1616
"displayName": "phone num",
1717
"detectorType": "NIGHTFALL_DETECTOR",
1818
"nightfallDetector": "PHONE_NUMBER"
1919
},
2020
{
2121
"minNumFindings": 1,
22-
"minConfidence": "VERY_UNLIKELY",
22+
"minConfidence": "LIKELY",
2323
"displayName": "api key",
2424
"detectorType": "NIGHTFALL_DETECTOR",
2525
"nightfallDetector": "API_KEY"
2626
},
2727
{
2828
"minNumFindings": 1,
29-
"minConfidence": "VERY_UNLIKELY",
29+
"minConfidence": "LIKELY",
3030
"displayName": "crypto key",
3131
"detectorType": "NIGHTFALL_DETECTOR",
3232
"nightfallDetector": "CRYPTOGRAPHIC_KEY"
33+
},
34+
{
35+
"minNumFindings": 1,
36+
"minConfidence": "LIKELY",
37+
"displayName": "password",
38+
"detectorType": "NIGHTFALL_DETECTOR",
39+
"nightfallDetector": "PASSWORD_IN_CODE"
3340
}
3441
],
3542
"logicalOp": "ANY"
@@ -46,3 +53,4 @@
4653
"fileInclusionList": ["*"],
4754
"fileExclusionList": ["README.md"]
4855
}
56+

internal/clients/diffreviewer/circleci/circleci_service_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ func (c *circleCiTestSuite) TestLoadEmptyConfig() {
292292
NightfallAPIKey: apiKey,
293293
NightfallDetectionRules: []nf.DetectionRule{
294294
{
295+
Name: "default detection rule",
295296
Detectors: []nf.Detector{
296297
{
297298
DetectorType: nf.DetectorTypeNightfallDetector,
@@ -315,6 +316,7 @@ func (c *circleCiTestSuite) TestLoadEmptyConfig() {
315316
MinNumFindings: 1,
316317
},
317318
},
319+
LogicalOp: nf.LogicalOpAny,
318320
},
319321
},
320322
NightfallMaxNumberRoutines: nightfallconfig.DefaultMaxNumberRoutines,

internal/clients/diffreviewer/github/github_service_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ func (g *githubTestSuite) TestLoadEmptyConfig() {
281281
NightfallAPIKey: apiKey,
282282
NightfallDetectionRules: []nf.DetectionRule{
283283
{
284+
Name: "default detection rule",
284285
Detectors: []nf.Detector{
285286
{
286287
DetectorType: nf.DetectorTypeNightfallDetector,
@@ -304,6 +305,7 @@ func (g *githubTestSuite) TestLoadEmptyConfig() {
304305
MinNumFindings: 1,
305306
},
306307
},
308+
LogicalOp: nf.LogicalOpAny,
307309
},
308310
},
309311
NightfallMaxNumberRoutines: nightfallconfig.DefaultMaxNumberRoutines,

internal/nightfallconfig/nightfall_config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const (
2525
var defaultNightfallConfig = &ConfigFile{
2626
DetectionRules: []nf.DetectionRule{
2727
{
28+
Name: "default detection rule",
2829
Detectors: []nf.Detector{
2930
{
3031
MinNumFindings: 1,
@@ -48,6 +49,7 @@ var defaultNightfallConfig = &ConfigFile{
4849
DisplayName: "PASSWORD_IN_CODE",
4950
},
5051
},
52+
LogicalOp: nf.LogicalOpAny,
5153
},
5254
},
5355
MaxNumberRoutines: DefaultMaxNumberRoutines,

internal/nightfallconfig/nightfall_config_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ func TestGetNightfallConfigMissingConfigFile(t *testing.T) {
7070
expectedConfig := &ConfigFile{
7171
DetectionRules: []nf.DetectionRule{
7272
{
73+
Name: "default detection rule",
7374
Detectors: []nf.Detector{
7475
{
7576
MinNumFindings: 1,
@@ -93,6 +94,7 @@ func TestGetNightfallConfigMissingConfigFile(t *testing.T) {
9394
NightfallDetector: "PASSWORD_IN_CODE",
9495
},
9596
},
97+
LogicalOp: nf.LogicalOpAny,
9698
},
9799
},
98100
MaxNumberRoutines: DefaultMaxNumberRoutines,

0 commit comments

Comments
 (0)