github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/cloud/policies/aws/neptune/encryption_customer_key.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 CheckEncryptionCustomerKey = rules.Register(
    12  	scan.Rule{
    13  		AVDID:       "AVD-AWS-0128",
    14  		Provider:    providers.AWSProvider,
    15  		Service:     "neptune",
    16  		ShortCode:   "encryption-customer-key",
    17  		Summary:     "Neptune encryption should use Customer Managed Keys",
    18  		Impact:      "Using AWS managed keys does not allow for fine grained control",
    19  		Resolution:  "Enable encryption using customer managed keys",
    20  		Explanation: `Encryption using AWS keys provides protection for your Neptune underlying storage. To increase control of the encryption and manage factors like rotation use customer managed keys.`,
    21  		Links: []string{
    22  			"https://docs.aws.amazon.com/neptune/latest/userguide/encrypt.html",
    23  		},
    24  		Terraform: &scan.EngineMetadata{
    25  			GoodExamples:        terraformCheckEncryptionCustomerKeyGoodExamples,
    26  			BadExamples:         terraformCheckEncryptionCustomerKeyBadExamples,
    27  			Links:               terraformCheckEncryptionCustomerKeyLinks,
    28  			RemediationMarkdown: terraformCheckEncryptionCustomerKeyRemediationMarkdown,
    29  		},
    30  		CloudFormation: &scan.EngineMetadata{
    31  			GoodExamples:        cloudFormationCheckEncryptionCustomerKeyGoodExamples,
    32  			BadExamples:         cloudFormationCheckEncryptionCustomerKeyBadExamples,
    33  			Links:               cloudFormationCheckEncryptionCustomerKeyLinks,
    34  			RemediationMarkdown: cloudFormationCheckEncryptionCustomerKeyRemediationMarkdown,
    35  		},
    36  		Severity: severity.High,
    37  	},
    38  	func(s *state.State) (results scan.Results) {
    39  		for _, cluster := range s.AWS.Neptune.Clusters {
    40  			if cluster.KMSKeyID.IsEmpty() {
    41  				results.Add(
    42  					"Cluster does not encrypt data with a customer managed key.",
    43  					cluster.KMSKeyID,
    44  				)
    45  			} else {
    46  				results.AddPassed(&cluster)
    47  			}
    48  		}
    49  		return
    50  	},
    51  )