github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/cloud/policies/azure/appservice/account_identity_registered.go (about) 1 package appservice 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 CheckAccountIdentityRegistered = rules.Register( 12 scan.Rule{ 13 AVDID: "AVD-AZU-0002", 14 Provider: providers.AzureProvider, 15 Service: "appservice", 16 ShortCode: "account-identity-registered", 17 Summary: "Web App has registration with AD enabled", 18 Impact: "Interaction between services can't easily be achieved without username/password", 19 Resolution: "Register the app identity with AD", 20 Explanation: `Registering the identity used by an App with AD allows it to interact with other services without using username and password`, 21 Links: []string{}, 22 Terraform: &scan.EngineMetadata{ 23 GoodExamples: terraformAccountIdentityRegisteredGoodExamples, 24 BadExamples: terraformAccountIdentityRegisteredBadExamples, 25 Links: terraformAccountIdentityRegisteredLinks, 26 RemediationMarkdown: terraformAccountIdentityRegisteredRemediationMarkdown, 27 }, 28 Severity: severity.Low, 29 }, 30 func(s *state.State) (results scan.Results) { 31 for _, service := range s.Azure.AppService.Services { 32 if service.Metadata.IsUnmanaged() { 33 continue 34 } 35 if service.Identity.Type.IsEmpty() { 36 results.Add( 37 "App service does not have an identity type.", 38 service.Identity.Type, 39 ) 40 } else { 41 results.AddPassed(&service) 42 } 43 } 44 return 45 }, 46 )