Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/nullify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,8 @@ integrations:
assignee:
id: 123456:abcd1234-abcd-1234-abcd-abcde12345666
name: John Smith
attack_surface:
enable: true
enable_dns_traversal: false
domain_names: [172.36.255.7,example.com]
ignore_domain_names: []
4 changes: 4 additions & 0 deletions pkg/merger/merger.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ func MergeConfigFiles(
}
}

if extraConfig.AttackSurface != nil {
config.AttackSurface = extraConfig.AttackSurface
}

if len(extraConfig.Notifications) > 0 && config.Notifications == nil {
config.Notifications = extraConfig.Notifications
}
Expand Down
24 changes: 24 additions & 0 deletions pkg/merger/merger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,30 @@ func TestMergeConfigFiles(t *testing.T) {
PriorityThreshold: models.PriorityImportant,
},
},
{
name: "only global config for attack surface monitoring",
globalConfig: &models.Configuration{
AttackSurface: &models.AttackSurface{
Enable: true,
EnableDNSTraversal: true,
DomainNames: []string{"example.com"},
IgnoreDomainNames: []string{"example2.com"},
},
},
repoConfig: nil,
expected: &models.Configuration{
EnablePullRequestReviews: models.Bool(true),
EnableIssueDashboards: models.Bool(true),
SeverityThreshold: parser.DefaultSeverityThreshold,
PriorityThreshold: parser.DefaultPriorityThreshold,
AttackSurface: &models.AttackSurface{
Enable: true,
EnableDNSTraversal: true,
DomainNames: []string{"example.com"},
IgnoreDomainNames: []string{"example2.com"},
},
},
},
} {
t.Run(scenario.name, func(t *testing.T) {
config := MergeConfigFiles(parser.NewDefaultConfig(), scenario.globalConfig, scenario.repoConfig)
Expand Down
4 changes: 2 additions & 2 deletions pkg/models/attack_surface.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package models

type AttackSurface struct {
// global only
Enable bool `yaml:"enable,omitempty"`
EnableDNSTraversal bool `yaml:"enable_dns_traversal,omitempty"`
Enable bool `yaml:"enable"`
EnableDNSTraversal bool `yaml:"enable_dns_traversal"`
DomainNames []string `yaml:"domain_names,omitempty"`
IgnoreDomainNames []string `yaml:"ignore_domain_names,omitempty"`
}
8 changes: 4 additions & 4 deletions pkg/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ type Configuration struct {
Integrations Integrations `yaml:"integrations,omitempty"`

// features
Code Code `yaml:"code,omitempty"`
Dependencies Dependencies `yaml:"dependencies,omitempty"`
Secrets Secrets `yaml:"secrets,omitempty"`
AttackSurface AttackSurface `yaml:"attack_surface,omitempty"`
Code Code `yaml:"code"`
Dependencies Dependencies `yaml:"dependencies"`
Secrets Secrets `yaml:"secrets"`
AttackSurface *AttackSurface `yaml:"attack_surface,omitempty"`

// TODO deprecate
SecretsWhitelist []string `yaml:"secrets_whitelist,omitempty"`
Expand Down
6 changes: 6 additions & 0 deletions tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ func TestIntegration(t *testing.T) {
OnFixTransition: "Done",
},
},
AttackSurface: &models.AttackSurface{
Enable: true,
EnableDNSTraversal: true,
DomainNames: []string{"172.36.255.7", "example.com"},
IgnoreDomainNames: []string{"jira.example.com"},
},
}

config, err := parser.LoadFromFile("nullify.yaml")
Expand Down
5 changes: 5 additions & 0 deletions tests/nullify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,8 @@ integrations:
severity_threshold: HIGH
priority_threshold: IMPORTANT
on_fix_transition: Done
attack_surface:
enable: true
enable_dns_traversal: true
domain_names: [172.36.255.7,example.com]
ignore_domain_names: [jira.example.com]
Loading