github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/cloud/policies/aws/neptune/enable_log_export.go (about)

     1  package neptune
     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 CheckEnableLogExport = rules.Register(
    12  	scan.Rule{
    13  		AVDID:       "AVD-AWS-0075",
    14  		Provider:    providers.AWSProvider,
    15  		Service:     "neptune",
    16  		ShortCode:   "enable-log-export",
    17  		Summary:     "Neptune logs export should be enabled",
    18  		Impact:      "Limited visibility of audit trail for changes to Neptune",
    19  		Resolution:  "Enable export logs",
    20  		Explanation: `Neptune does not have auditing by default. To ensure that you are able to accurately audit the usage of your Neptune instance you should enable export logs.`,
    21  		Links: []string{
    22  			"https://docs.aws.amazon.com/neptune/latest/userguide/auditing.html",
    23  		},
    24  		Terraform: &scan.EngineMetadata{
    25  			GoodExamples:        terraformEnableLogExportGoodExamples,
    26  			BadExamples:         terraformEnableLogExportBadExamples,
    27  			Links:               terraformEnableLogExportLinks,
    28  			RemediationMarkdown: terraformEnableLogExportRemediationMarkdown,
    29  		},
    30  		CloudFormation: &scan.EngineMetadata{
    31  			GoodExamples:        cloudFormationEnableLogExportGoodExamples,
    32  			BadExamples:         cloudFormationEnableLogExportBadExamples,
    33  			Links:               cloudFormationEnableLogExportLinks,
    34  			RemediationMarkdown: cloudFormationEnableLogExportRemediationMarkdown,
    35  		},
    36  		Severity: severity.Medium,
    37  	},
    38  	func(s *state.State) (results scan.Results) {
    39  		for _, cluster := range s.AWS.Neptune.Clusters {
    40  			if cluster.Logging.Audit.IsFalse() {
    41  				results.Add(
    42  					"Cluster does not have audit logging enabled.",
    43  					cluster.Logging.Audit,
    44  				)
    45  			} else {
    46  				results.AddPassed(&cluster)
    47  			}
    48  		}
    49  		return
    50  	},
    51  )