Skip to content

Commit b854099

Browse files
author
Vikranth Subramanian
committed
more modifications for aws integration
1 parent 38b8173 commit b854099

File tree

4 files changed

+54
-1
lines changed

4 files changed

+54
-1
lines changed

examples/nullify.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ attack_surface:
119119
- domain_names: [live.prod.hosting.com]
120120
http:
121121
paths: [/main, /api/**/create]
122+
aws_integration_configuration:
123+
enable_aws_integration: true
124+
primary_account_id: 123456789012
125+
primary_region: ap-southeast-2
126+
target_regions: [ap-southeast-2, us-east-2]
127+
target_accounts: [123456789012, 123456789013]
122128
ignore:
123129
- http:
124130
methods: [DELETE]

pkg/merger/merger_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,38 @@ func TestMergeConfigFiles(t *testing.T) {
418418
},
419419
},
420420
},
421+
{
422+
name: "attack surface with AWS integration merge",
423+
globalConfig: &models.Configuration{
424+
AttackSurface: &models.AttackSurface{
425+
Enable: true,
426+
AWSIntegration: &models.AWSIntegration{
427+
EnableAWSIntegration: true,
428+
PrimaryAccountID: "111111111111",
429+
PrimaryRegion: "ap-southeast-2",
430+
TargetRegions: &[]string{"ap-southeast-1", "us-east-2"},
431+
TargetAccounts: &[]string{"222222222222", "333333333333"},
432+
},
433+
},
434+
},
435+
repoConfig: nil,
436+
expected: &models.Configuration{
437+
EnablePullRequestReviews: models.Bool(true),
438+
EnableIssueDashboards: models.Bool(true),
439+
SeverityThreshold: parser.DefaultSeverityThreshold,
440+
PriorityThreshold: parser.DefaultPriorityThreshold,
441+
AttackSurface: &models.AttackSurface{
442+
Enable: true,
443+
AWSIntegration: &models.AWSIntegration{
444+
EnableAWSIntegration: true,
445+
PrimaryAccountID: "111111111111",
446+
PrimaryRegion: "ap-southeast-2",
447+
TargetRegions: &[]string{"ap-southeast-1", "us-east-2"},
448+
TargetAccounts: &[]string{"222222222222", "333333333333"},
449+
},
450+
},
451+
},
452+
},
421453
} {
422454
t.Run(scenario.name, func(t *testing.T) {
423455
config := MergeConfigFiles(parser.NewDefaultConfig(), scenario.globalConfig, scenario.repoConfig)

pkg/models/attack_surface.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ type AttackSurface struct {
44
// global only
55
Enable bool `yaml:"enable"`
66
EnableDNSEnumeration bool `yaml:"enable_dns_enumeration"`
7-
EnableAWSIntegration bool `yaml:"enable_aws_integration"`
7+
AWSIntegration *AWSIntegration `yaml:"aws_integration,omitempty"`
88
IPAddresses []string `yaml:"ip_addresses,omitempty"`
99
DomainNames []string `yaml:"domain_names,omitempty"`
1010
IncludeOnly []AttackSurfaceIncludeOnly `yaml:"include_only,omitempty"`
1111
Ignore []AttackSurfaceIgnore `yaml:"ignore,omitempty"`
1212
}
1313

14+
type AWSIntegration struct {
15+
EnableAWSIntegration bool `yaml:"enable_aws_integration"`
16+
PrimaryAccountID string `yaml:"primary_account_id"`
17+
PrimaryRegion string `yaml:"primary_region"`
18+
TargetRegions *[]string `yaml:"target_regions,omitempty"`
19+
TargetAccounts *[]string `yaml:"target_accounts,omitempty"`
20+
}
21+
1422
type AttackSurfaceIncludeOnly struct {
1523
DomainNames []string `yaml:"domain_names,omitempty"`
1624
HTTP *HTTPAttackSurfaceIncludeOnly `yaml:"http,omitempty"`

tests/integration_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@ func TestIntegration(t *testing.T) {
188188
},
189189
},
190190
},
191+
AWSIntegration: &models.AWSIntegration{
192+
EnableAWSIntegration: true,
193+
PrimaryAccountID: "123456789012",
194+
PrimaryRegion: "ap-southeast-2",
195+
TargetRegions: &[]string{"ap-southeast-2", "us-east-2"},
196+
TargetAccounts: &[]string{"123456789012", "123456789013"},
197+
},
191198
},
192199
}
193200

0 commit comments

Comments
 (0)