From 9beb0fd2e485a2dbd97647eda4e186e8d76e5fa5 Mon Sep 17 00:00:00 2001 From: vik Date: Tue, 3 Jun 2025 12:03:04 +1000 Subject: [PATCH 1/3] update the config file logic --- pkg/merger/merger_test.go | 50 --------------------------------------- 1 file changed, 50 deletions(-) diff --git a/pkg/merger/merger_test.go b/pkg/merger/merger_test.go index 36549b2..8fc2bb0 100644 --- a/pkg/merger/merger_test.go +++ b/pkg/merger/merger_test.go @@ -82,14 +82,6 @@ func TestMergeConfigFiles(t *testing.T) { SeverityThreshold: models.SeverityHigh, PriorityThreshold: models.PriorityImportant, }, - AWS: &models.AWS{ - Enable: true, - RoleNameToAssume: "nullify-role", - PrimaryAccountID: "123456789012", - PrimaryRegion: "ap-southeast-2", - TargetRegions: &[]string{"ap-southeast-2", "us-east-2"}, - TargetAccounts: &[]string{"123456789012", "123456789013"}, - }, }, }, expected: &models.Configuration{ @@ -148,14 +140,6 @@ func TestMergeConfigFiles(t *testing.T) { SeverityThreshold: models.SeverityHigh, PriorityThreshold: models.PriorityImportant, }, - AWS: &models.AWS{ - Enable: true, - RoleNameToAssume: "nullify-role", - PrimaryAccountID: "123456789012", - PrimaryRegion: "ap-southeast-2", - TargetRegions: &[]string{"ap-southeast-2", "us-east-2"}, - TargetAccounts: &[]string{"123456789012", "123456789013"}, - }, }, }, }, @@ -220,14 +204,6 @@ func TestMergeConfigFiles(t *testing.T) { Low: "low", }, }, - AWS: &models.AWS{ - Enable: true, - RoleNameToAssume: "nullify-role", - PrimaryAccountID: "123456789012", - PrimaryRegion: "ap-southeast-2", - TargetRegions: &[]string{"ap-southeast-2", "us-east-2"}, - TargetAccounts: &[]string{"123456789012", "123456789013"}, - }, }, }, repoConfig: nil, @@ -293,14 +269,6 @@ func TestMergeConfigFiles(t *testing.T) { Low: "low", }, }, - AWS: &models.AWS{ - Enable: true, - RoleNameToAssume: "nullify-role", - PrimaryAccountID: "123456789012", - PrimaryRegion: "ap-southeast-2", - TargetRegions: &[]string{"ap-southeast-2", "us-east-2"}, - TargetAccounts: &[]string{"123456789012", "123456789013"}, - }, }, }, }, @@ -454,24 +422,6 @@ func TestMergeConfigFiles(t *testing.T) { }, }, }, - { - name: "attack surface with AWS integration merge", - globalConfig: &models.Configuration{ - AttackSurface: &models.AttackSurface{ - Enable: true, - }, - }, - repoConfig: nil, - expected: &models.Configuration{ - EnablePullRequestReviews: models.Bool(true), - EnableIssueDashboards: models.Bool(true), - SeverityThreshold: parser.DefaultSeverityThreshold, - PriorityThreshold: parser.DefaultPriorityThreshold, - AttackSurface: &models.AttackSurface{ - Enable: true, - }, - }, - }, } { t.Run(scenario.name, func(t *testing.T) { config := MergeConfigFiles(parser.NewDefaultConfig(), scenario.globalConfig, scenario.repoConfig) From 952d5d04f7b09d48d51404d9775880779fc54594 Mon Sep 17 00:00:00 2001 From: vik Date: Tue, 3 Jun 2025 12:18:27 +1000 Subject: [PATCH 2/3] update more files --- pkg/merger/merger.go | 22 ---------------------- pkg/models/integrations.go | 10 ---------- 2 files changed, 32 deletions(-) diff --git a/pkg/merger/merger.go b/pkg/merger/merger.go index fa88740..83df5f8 100644 --- a/pkg/merger/merger.go +++ b/pkg/merger/merger.go @@ -79,28 +79,6 @@ func MergeConfigFiles( } } - if extraConfig.Integrations.AWS != nil { - if config.Integrations.AWS == nil { - config.Integrations.AWS = extraConfig.Integrations.AWS - } else { - config.Integrations.AWS.Enable = extraConfig.Integrations.AWS.Enable - - config.Integrations.AWS.RoleNameToAssume = extraConfig.Integrations.AWS.RoleNameToAssume - config.Integrations.AWS.PrimaryAccountID = extraConfig.Integrations.AWS.PrimaryAccountID - config.Integrations.AWS.PrimaryRegion = extraConfig.Integrations.AWS.PrimaryRegion - - if extraConfig.Integrations.AWS.PrimaryRegion != "" { - config.Integrations.AWS.PrimaryRegion = extraConfig.Integrations.AWS.PrimaryRegion - } - if extraConfig.Integrations.AWS.TargetRegions != nil { - config.Integrations.AWS.TargetRegions = extraConfig.Integrations.AWS.TargetRegions - } - if extraConfig.Integrations.AWS.TargetAccounts != nil { - config.Integrations.AWS.TargetAccounts = extraConfig.Integrations.AWS.TargetAccounts - } - } - } - if len(extraConfig.IgnoreDirs) > 0 { config.IgnoreDirs = extraConfig.IgnoreDirs } diff --git a/pkg/models/integrations.go b/pkg/models/integrations.go index 0e5c592..2a3a7c7 100644 --- a/pkg/models/integrations.go +++ b/pkg/models/integrations.go @@ -2,7 +2,6 @@ package models type Integrations struct { Jira *Jira `yaml:"jira,omitempty"` - AWS *AWS `yaml:"aws,omitempty"` } type Jira struct { @@ -32,12 +31,3 @@ type Assignee struct { Name string `yaml:"name,omitempty"` ID string `yaml:"id,omitempty"` } - -type AWS struct { - Enable bool `yaml:"enable"` - RoleNameToAssume string `yaml:"role_name_to_assume"` - PrimaryAccountID string `yaml:"primary_account_id"` - PrimaryRegion string `yaml:"primary_region"` - TargetRegions *[]string `yaml:"target_regions,omitempty"` - TargetAccounts *[]string `yaml:"target_accounts,omitempty"` -} From 94b58ebe52110725f263d350afb8742e959e5f65 Mon Sep 17 00:00:00 2001 From: vik Date: Tue, 3 Jun 2025 12:20:46 +1000 Subject: [PATCH 3/3] remove from integration test --- tests/integration_test.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/integration_test.go b/tests/integration_test.go index ef350cc..2a937ba 100644 --- a/tests/integration_test.go +++ b/tests/integration_test.go @@ -153,14 +153,6 @@ func TestIntegration(t *testing.T) { PriorityThreshold: models.PriorityImportant, OnFixTransition: "Done", }, - AWS: &models.AWS{ - Enable: true, - RoleNameToAssume: "nullify-role", - PrimaryAccountID: "123456789012", - PrimaryRegion: "ap-southeast-2", - TargetRegions: &[]string{"ap-southeast-2", "us-east-2"}, - TargetAccounts: &[]string{"123456789012", "123456789013"}, - }, }, AttackSurface: &models.AttackSurface{ Enable: true,