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
12 changes: 6 additions & 6 deletions examples/nullify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ integrations:
attack_surface:
enable: true
enable_dns_enumeration: true
ip_addresses: [10.11.12.13, 10.0.0.1-254]
domain_names: [example.com, prod.hosting.com]
hosts: [example.com, prod.hosting.com, 10.11.12.13, 10.0.0.*]
include_only:
- domain_names: [live.prod.hosting.com]
- hosts: [live.prod.hosting.com]
http:
methods: [GET, POST]
paths: [/main, /api/**/create]
aws_integration:
enable: true
Expand All @@ -128,11 +128,11 @@ attack_surface:
ignore:
- http:
methods: [DELETE]
- domain_names: [jira.example.com, "*.testing.example.com"]
- ip_addresses: [100.110.120.130]
- hosts: [jira.example.com, "*.testing.example.com"]
- hosts: [100.110.120.130]
transport_protocols: [tcp]
ports: [22, 8080, 9990-9999]
- domain_names: ["dev.*", "staging.*"]
- hosts: ["dev.*", "staging.*"]
http:
paths: [/auth]
methods: [POST]
28 changes: 14 additions & 14 deletions pkg/merger/merger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,13 @@ func TestMergeConfigFiles(t *testing.T) {
AttackSurface: &models.AttackSurface{
Enable: true,
EnableDNSEnumeration: true,
IPAddresses: []string{"10.11.12.13", "10.0.0.1-254"},
DomainNames: []string{"example.com", "prod.hosting.com"},
Hosts: []string{"example.com", "prod.hosting.com", "10.11.12.13", "10.0.0.*"},
IncludeOnly: []models.AttackSurfaceIncludeOnly{
{
DomainNames: []string{"live.prod.hosting.com"},
Hosts: []string{"live.prod.hosting.com"},
HTTP: &models.HTTPAttackSurfaceIncludeOnly{
Paths: []string{"/main", "/api/**/create"},
Methods: []string{"GET", "POST"},
Paths: []string{"/main", "/api/**/create"},
},
},
},
Expand All @@ -357,15 +357,15 @@ func TestMergeConfigFiles(t *testing.T) {
},
},
{
DomainNames: []string{"jira.example.com", "*.testing.example.com"},
Hosts: []string{"jira.example.com", "*.testing.example.com"},
},
{
IPAddresses: []string{"100.110.120.130"},
Hosts: []string{"100.110.120.130"},
TransportProtocols: []string{"tcp"},
Ports: []string{"22", "8080", "9990-9999"},
},
{
DomainNames: []string{"dev.*", "staging.*"},
Hosts: []string{"dev.*", "staging.*"},
HTTP: &models.HTTPAttackSurfaceIgnore{
Paths: []string{"/auth"},
Methods: []string{"POST"},
Expand All @@ -383,13 +383,13 @@ func TestMergeConfigFiles(t *testing.T) {
AttackSurface: &models.AttackSurface{
Enable: true,
EnableDNSEnumeration: true,
IPAddresses: []string{"10.11.12.13", "10.0.0.1-254"},
DomainNames: []string{"example.com", "prod.hosting.com"},
Hosts: []string{"example.com", "prod.hosting.com", "10.11.12.13", "10.0.0.*"},
IncludeOnly: []models.AttackSurfaceIncludeOnly{
{
DomainNames: []string{"live.prod.hosting.com"},
Hosts: []string{"live.prod.hosting.com"},
HTTP: &models.HTTPAttackSurfaceIncludeOnly{
Paths: []string{"/main", "/api/**/create"},
Methods: []string{"GET", "POST"},
Paths: []string{"/main", "/api/**/create"},
},
},
},
Expand All @@ -400,15 +400,15 @@ func TestMergeConfigFiles(t *testing.T) {
},
},
{
DomainNames: []string{"jira.example.com", "*.testing.example.com"},
Hosts: []string{"jira.example.com", "*.testing.example.com"},
},
{
IPAddresses: []string{"100.110.120.130"},
Hosts: []string{"100.110.120.130"},
TransportProtocols: []string{"tcp"},
Ports: []string{"22", "8080", "9990-9999"},
},
{
DomainNames: []string{"dev.*", "staging.*"},
Hosts: []string{"dev.*", "staging.*"},
HTTP: &models.HTTPAttackSurfaceIgnore{
Paths: []string{"/auth"},
Methods: []string{"POST"},
Expand Down
13 changes: 6 additions & 7 deletions pkg/models/attack_surface.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ type AttackSurface struct {
Enable bool `yaml:"enable"`
EnableDNSEnumeration bool `yaml:"enable_dns_enumeration"`
AWSIntegration *AWSIntegration `yaml:"aws_integration"`
IPAddresses []string `yaml:"ip_addresses,omitempty"`
DomainNames []string `yaml:"domain_names,omitempty"`
Hosts []string `yaml:"hosts,omitempty"`
IncludeOnly []AttackSurfaceIncludeOnly `yaml:"include_only,omitempty"`
Ignore []AttackSurfaceIgnore `yaml:"ignore,omitempty"`
}
Expand All @@ -20,18 +19,18 @@ type AWSIntegration struct {
}

type AttackSurfaceIncludeOnly struct {
DomainNames []string `yaml:"domain_names,omitempty"`
HTTP *HTTPAttackSurfaceIncludeOnly `yaml:"http,omitempty"`
Hosts []string `yaml:"hosts,omitempty"`
HTTP *HTTPAttackSurfaceIncludeOnly `yaml:"http,omitempty"`
}

type HTTPAttackSurfaceIncludeOnly struct {
Paths []string `yaml:"paths,omitempty"`
Methods []string `yaml:"methods,omitempty"`
Paths []string `yaml:"paths,omitempty"`
}

type AttackSurfaceIgnore struct {
// empty fields are equivalent to *
IPAddresses []string `yaml:"ip_addresses,omitempty"`
DomainNames []string `yaml:"domain_names,omitempty"`
Hosts []string `yaml:"hosts,omitempty"`
TransportProtocols []string `yaml:"transport_protocols,omitempty"`
Ports []string `yaml:"ports,omitempty"`
HTTP *HTTPAttackSurfaceIgnore `yaml:"http,omitempty"`
Expand Down
14 changes: 7 additions & 7 deletions tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ func TestIntegration(t *testing.T) {
AttackSurface: &models.AttackSurface{
Enable: true,
EnableDNSEnumeration: true,
IPAddresses: []string{"10.11.12.13", "10.0.0.1-254"},
DomainNames: []string{"example.com", "prod.hosting.com"},
Hosts: []string{"example.com", "prod.hosting.com", "10.11.12.13", "10.0.0.*"},
IncludeOnly: []models.AttackSurfaceIncludeOnly{
{
DomainNames: []string{"live.prod.hosting.com"},
Hosts: []string{"live.prod.hosting.com"},
HTTP: &models.HTTPAttackSurfaceIncludeOnly{
Paths: []string{"/main", "/api/**/create"},
Methods: []string{"GET", "POST"},
Paths: []string{"/main", "/api/**/create"},
},
},
},
Expand All @@ -173,15 +173,15 @@ func TestIntegration(t *testing.T) {
},
},
{
DomainNames: []string{"jira.example.com", "*.testing.example.com"},
Hosts: []string{"jira.example.com", "*.testing.example.com"},
},
{
IPAddresses: []string{"100.110.120.130"},
Hosts: []string{"100.110.120.130"},
TransportProtocols: []string{"tcp"},
Ports: []string{"22", "8080", "9990-9999"},
},
{
DomainNames: []string{"dev.*", "staging.*"},
Hosts: []string{"dev.*", "staging.*"},
HTTP: &models.HTTPAttackSurfaceIgnore{
Paths: []string{"/auth"},
Methods: []string{"POST"},
Expand Down
12 changes: 6 additions & 6 deletions tests/nullify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,20 @@ integrations:
attack_surface:
enable: true
enable_dns_enumeration: true
ip_addresses: [10.11.12.13, 10.0.0.1-254]
domain_names: [example.com, prod.hosting.com]
hosts: [example.com, prod.hosting.com, 10.11.12.13, 10.0.0.*]
include_only:
- domain_names: [live.prod.hosting.com]
- hosts: [live.prod.hosting.com]
http:
methods: [GET, POST]
paths: [/main, /api/**/create]
ignore:
- http:
methods: [DELETE]
- domain_names: [jira.example.com, "*.testing.example.com"]
- ip_addresses: [100.110.120.130]
- hosts: [jira.example.com, "*.testing.example.com"]
- hosts: [100.110.120.130]
transport_protocols: [tcp]
ports: [22, 8080, 9990-9999]
- domain_names: ["dev.*", "staging.*"]
- hosts: ["dev.*", "staging.*"]
http:
paths: [/auth]
methods: [POST]
Expand Down
Loading