github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/rules/cloud/policies/aws/neptune/enable_storage_encryption.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 CheckEnableStorageEncryption = rules.Register(
    12  	scan.Rule{
    13  		AVDID:       "AVD-AWS-0076",
    14  		Provider:    providers.AWSProvider,
    15  		Service:     "neptune",
    16  		ShortCode:   "enable-storage-encryption",
    17  		Summary:     "Neptune storage must be encrypted at rest",
    18  		Impact:      "Unencrypted sensitive data is vulnerable to compromise.",
    19  		Resolution:  "Enable encryption of Neptune storage",
    20  		Explanation: `Encryption of Neptune storage ensures that if their is compromise of the disks, the data is still protected.`,
    21  		Links: []string{
    22  			"https://docs.aws.amazon.com/neptune/latest/userguide/encrypt.html",
    23  		},
    24  		Terraform: &scan.EngineMetadata{
    25  			GoodExamples:        terraformEnableStorageEncryptionGoodExamples,
    26  			BadExamples:         terraformEnableStorageEncryptionBadExamples,
    27  			Links:               terraformEnableStorageEncryptionLinks,
    28  			RemediationMarkdown: terraformEnableStorageEncryptionRemediationMarkdown,
    29  		},
    30  		CloudFormation: &scan.EngineMetadata{
    31  			GoodExamples:        cloudFormationEnableStorageEncryptionGoodExamples,
    32  			BadExamples:         cloudFormationEnableStorageEncryptionBadExamples,
    33  			Links:               cloudFormationEnableStorageEncryptionLinks,
    34  			RemediationMarkdown: cloudFormationEnableStorageEncryptionRemediationMarkdown,
    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.StorageEncrypted.IsFalse() {
    41  				results.Add(
    42  					"Cluster does not have storage encryption enabled.",
    43  					cluster.StorageEncrypted,
    44  				)
    45  			} else {
    46  				results.AddPassed(&cluster)
    47  			}
    48  		}
    49  		return
    50  	},
    51  )