github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/cloud/policies/aws/rds/enable_performance_insights.go (about) 1 package rds 2 3 import ( 4 "github.com/khulnasoft-lab/defsec/internal/rules" 5 "github.com/khulnasoft-lab/defsec/pkg/providers" 6 "github.com/khulnasoft-lab/defsec/pkg/scan" 7 "github.com/khulnasoft-lab/defsec/pkg/severity" 8 "github.com/khulnasoft-lab/defsec/pkg/state" 9 ) 10 11 var CheckEnablePerformanceInsights = rules.Register( 12 scan.Rule{ 13 AVDID: "AVD-AWS-0133", 14 Provider: providers.AWSProvider, 15 Service: "rds", 16 ShortCode: "enable-performance-insights", 17 Summary: "Enable Performance Insights to detect potential problems", 18 Impact: "Without adequate monitoring, performance related issues may go unreported and potentially lead to compromise.", 19 Resolution: "Enable performance insights", 20 Explanation: `Enabling Performance insights allows for greater depth in monitoring data. 21 22 For example, information about active sessions could help diagose a compromise or assist in the investigation`, 23 Links: []string{ 24 "https://aws.amazon.com/rds/performance-insights/", 25 }, 26 Terraform: &scan.EngineMetadata{ 27 GoodExamples: terraformEnablePerformanceInsightsGoodExamples, 28 BadExamples: terraformEnablePerformanceInsightsBadExamples, 29 Links: terraformEnablePerformanceInsightsLinks, 30 RemediationMarkdown: terraformEnablePerformanceInsightsRemediationMarkdown, 31 }, 32 CloudFormation: &scan.EngineMetadata{ 33 GoodExamples: cloudFormationEnablePerformanceInsightsGoodExamples, 34 BadExamples: cloudFormationEnablePerformanceInsightsBadExamples, 35 Links: cloudFormationEnablePerformanceInsightsLinks, 36 RemediationMarkdown: cloudFormationEnablePerformanceInsightsRemediationMarkdown, 37 }, 38 Severity: severity.Low, 39 }, 40 func(s *state.State) (results scan.Results) { 41 for _, cluster := range s.AWS.RDS.Clusters { 42 for _, instance := range cluster.Instances { 43 if instance.Metadata.IsUnmanaged() { 44 continue 45 } 46 if instance.PerformanceInsights.Enabled.IsFalse() { 47 results.Add( 48 "Instance does not have performance insights enabled.", 49 instance.PerformanceInsights.Enabled, 50 ) 51 } else { 52 results.AddPassed(&instance) 53 } 54 } 55 } 56 for _, instance := range s.AWS.RDS.Instances { 57 if instance.Metadata.IsUnmanaged() { 58 continue 59 } 60 if instance.PerformanceInsights.Enabled.IsFalse() { 61 results.Add( 62 "Instance does not have performance insights enabled.", 63 instance.PerformanceInsights.Enabled, 64 ) 65 } else { 66 results.AddPassed(&instance) 67 } 68 } 69 70 return 71 }, 72 )