github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/cloud/policies/azure/appservice/enable_http2.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 CheckEnableHttp2 = rules.Register( 12 scan.Rule{ 13 AVDID: "AVD-AZU-0005", 14 Provider: providers.AzureProvider, 15 Service: "appservice", 16 ShortCode: "enable-http2", 17 Summary: "Web App uses the latest HTTP version", 18 Impact: "Outdated versions of HTTP has security vulnerabilities", 19 Resolution: "Use the latest version of HTTP", 20 Explanation: `Use the latest version of HTTP to ensure you are benefiting from security fixes`, 21 Links: []string{}, 22 Terraform: &scan.EngineMetadata{ 23 GoodExamples: terraformEnableHttp2GoodExamples, 24 BadExamples: terraformEnableHttp2BadExamples, 25 Links: terraformEnableHttp2Links, 26 RemediationMarkdown: terraformEnableHttp2RemediationMarkdown, 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.Site.EnableHTTP2.IsFalse() { 36 results.Add( 37 "App service does not have HTTP/2 enabled.", 38 service.Site.EnableHTTP2, 39 ) 40 } else { 41 results.AddPassed(&service) 42 } 43 } 44 return 45 }, 46 )