github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/cloud/policies/azure/database/threat_alert_email_to_owner.go (about) 1 package database 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 CheckThreatAlertEmailToOwner = rules.Register( 12 scan.Rule{ 13 AVDID: "AVD-AZU-0023", 14 Provider: providers.AzureProvider, 15 Service: "database", 16 ShortCode: "threat-alert-email-to-owner", 17 Summary: "Security threat alerts go to subcription owners and co-administrators", 18 Impact: "Administrators and subscription owners may have a delayed response", 19 Resolution: "Enable email to subscription owners", 20 Explanation: `Subscription owners should be notified when there are security alerts. By ensuring the administrators of the account have been notified they can quickly assist in any required remediation`, 21 Links: []string{}, 22 Terraform: &scan.EngineMetadata{ 23 GoodExamples: terraformThreatAlertEmailToOwnerGoodExamples, 24 BadExamples: terraformThreatAlertEmailToOwnerBadExamples, 25 Links: terraformThreatAlertEmailToOwnerLinks, 26 RemediationMarkdown: terraformThreatAlertEmailToOwnerRemediationMarkdown, 27 }, 28 Severity: severity.Low, 29 }, 30 func(s *state.State) (results scan.Results) { 31 for _, server := range s.Azure.Database.MSSQLServers { 32 for _, policy := range server.SecurityAlertPolicies { 33 if policy.EmailAccountAdmins.IsFalse() { 34 results.Add( 35 "Security alert policy does not alert account admins.", 36 policy.EmailAccountAdmins, 37 ) 38 } else { 39 results.AddPassed(&policy) 40 } 41 } 42 } 43 return 44 }, 45 )