Skip to content

Commit 69b1e82

Browse files
fix tests
1 parent 7d20957 commit 69b1e82

File tree

4 files changed

+33
-29
lines changed

4 files changed

+33
-29
lines changed

pkg/merger/merger.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ func MergeConfigFiles(
125125
}
126126
}
127127

128+
if extraConfig.AttackSurface != nil {
129+
config.AttackSurface = extraConfig.AttackSurface
130+
}
131+
128132
if len(extraConfig.Notifications) > 0 && config.Notifications == nil {
129133
config.Notifications = extraConfig.Notifications
130134
}

pkg/merger/merger_test.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,30 @@ func TestMergeConfigFiles(t *testing.T) {
334334
PriorityThreshold: models.PriorityImportant,
335335
},
336336
},
337+
{
338+
name: "only global config for attack surface monitoring",
339+
globalConfig: &models.Configuration{
340+
AttackSurface: &models.AttackSurface{
341+
Enable: true,
342+
EnableDNSTraversal: true,
343+
DomainNames: []string{"example.com"},
344+
IgnoreDomainNames: []string{"example2.com"},
345+
},
346+
},
347+
repoConfig: nil,
348+
expected: &models.Configuration{
349+
EnablePullRequestReviews: models.Bool(true),
350+
EnableIssueDashboards: models.Bool(true),
351+
SeverityThreshold: parser.DefaultSeverityThreshold,
352+
PriorityThreshold: parser.DefaultPriorityThreshold,
353+
AttackSurface: &models.AttackSurface{
354+
Enable: true,
355+
EnableDNSTraversal: true,
356+
DomainNames: []string{"example.com"},
357+
IgnoreDomainNames: []string{"example2.com"},
358+
},
359+
},
360+
},
337361
} {
338362
t.Run(scenario.name, func(t *testing.T) {
339363
config := MergeConfigFiles(parser.NewDefaultConfig(), scenario.globalConfig, scenario.repoConfig)
@@ -692,30 +716,6 @@ func TestMergeJira(t *testing.T) {
692716
},
693717
},
694718
},
695-
{
696-
name: "only global config for attack surface monitoring",
697-
globalConfig: &models.Configuration{
698-
AttackSurface: models.AttackSurface{
699-
Enable: true,
700-
EnableDNSTraversal: true,
701-
DomainNames: []string{"example.com"},
702-
IgnoreDomainNames: []string{"example2.com"},
703-
},
704-
},
705-
repoConfig: nil,
706-
expected: &models.Configuration{
707-
EnablePullRequestReviews: models.Bool(true),
708-
EnableIssueDashboards: models.Bool(true),
709-
SeverityThreshold: parser.DefaultSeverityThreshold,
710-
PriorityThreshold: parser.DefaultPriorityThreshold,
711-
AttackSurface: models.AttackSurface{
712-
Enable: true,
713-
EnableDNSTraversal: true,
714-
DomainNames: []string{"example.com"},
715-
IgnoreDomainNames: []string{"example2.com"},
716-
},
717-
},
718-
},
719719
} {
720720
t.Run(scenario.name, func(t *testing.T) {
721721
config := MergeConfigFiles(parser.NewDefaultConfig(), scenario.globalConfig, scenario.repoConfig)

pkg/models/models.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ type Configuration struct {
1818
Integrations Integrations `yaml:"integrations,omitempty"`
1919

2020
// features
21-
Code Code `yaml:"code"`
22-
Dependencies Dependencies `yaml:"dependencies"`
23-
Secrets Secrets `yaml:"secrets"`
24-
AttackSurface AttackSurface `yaml:"attack_surface"`
21+
Code Code `yaml:"code"`
22+
Dependencies Dependencies `yaml:"dependencies"`
23+
Secrets Secrets `yaml:"secrets"`
24+
AttackSurface *AttackSurface `yaml:"attack_surface,omitempty"`
2525

2626
// TODO deprecate
2727
SecretsWhitelist []string `yaml:"secrets_whitelist,omitempty"`

tests/integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func TestIntegration(t *testing.T) {
153153
OnFixTransition: "Done",
154154
},
155155
},
156-
AttackSurface: models.AttackSurface{
156+
AttackSurface: &models.AttackSurface{
157157
Enable: true,
158158
EnableDNSTraversal: true,
159159
DomainNames: []string{"172.36.255.7", "example.com"},

0 commit comments

Comments
 (0)