github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/cloud/policies/azure/datafactory/no_public_access.go (about)

     1  package datafactory
     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 CheckNoPublicAccess = rules.Register(
    12  	scan.Rule{
    13  		AVDID:      "AVD-AZU-0035",
    14  		Provider:   providers.AzureProvider,
    15  		Service:    "datafactory",
    16  		ShortCode:  "no-public-access",
    17  		Summary:    "Data Factory should have public access disabled, the default is enabled.",
    18  		Impact:     "Data factory is publicly accessible",
    19  		Resolution: "Set public access to disabled for Data Factory",
    20  		Explanation: `Data Factory has public access set to true by default.
    21  
    22  Disabling public network access is applicable only to the self-hosted integration runtime, not to Azure Integration Runtime and SQL Server Integration Services (SSIS) Integration Runtime.`,
    23  		Links: []string{
    24  			"https://docs.microsoft.com/en-us/azure/data-factory/data-movement-security-considerations#hybrid-scenarios",
    25  		},
    26  		Terraform: &scan.EngineMetadata{
    27  			GoodExamples:        terraformNoPublicAccessGoodExamples,
    28  			BadExamples:         terraformNoPublicAccessBadExamples,
    29  			Links:               terraformNoPublicAccessLinks,
    30  			RemediationMarkdown: terraformNoPublicAccessRemediationMarkdown,
    31  		},
    32  		Severity: severity.Critical,
    33  	},
    34  	func(s *state.State) (results scan.Results) {
    35  		for _, factory := range s.Azure.DataFactory.DataFactories {
    36  			if factory.EnablePublicNetwork.IsTrue() {
    37  				results.Add(
    38  					"Data factory allows public network access.",
    39  					factory.EnablePublicNetwork,
    40  				)
    41  			} else {
    42  				results.AddPassed(&factory)
    43  			}
    44  		}
    45  		return
    46  	},
    47  )