-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(terraform): check if SSE configuration block is nil #1457
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nikpivkin
commented
Sep 19, 2023
@@ -47,7 +47,7 @@ var CheckEncryptionCustomerKey = rules.Register( | |||
if bucket.Encryption.KMSKeyId.IsEmpty() { | |||
results.Add( | |||
"Bucket does not encrypt data with a customer managed key.", | |||
&bucket.Encryption, | |||
bucket.Encryption.KMSKeyId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed metadata output.
before:
See https://avd.aquasec.com/misconfig/avd-aws-0132
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
main.tf:1-9
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 ┌ resource "aws_s3_bucket" "this" {
2 │ server_side_encryption_configuration {
3 │ rule {
4 │ apply_server_side_encryption_by_default {
5 │ }
6 │ }
7 │ }
8 │
9 └ }
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
after:
See https://avd.aquasec.com/misconfig/avd-aws-0132
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
main.tf:5
via main.tf:4-6 (apply_server_side_encryption_by_default)
via main.tf:3-7 (rule)
via main.tf:2-8 (server_side_encryption_configuration)
via main.tf:1-10 (aws_s3_bucket.this)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 resource "aws_s3_bucket" "this" {
2 server_side_encryption_configuration {
3 rule {
4 apply_server_side_encryption_by_default {
5 [ kms_master_key_id = ""
6 }
7 }
8 }
9
10 }
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
nikpivkin
commented
Sep 19, 2023
@@ -299,7 +299,7 @@ func (b *Block) GetAttribute(name string) *Attribute { | |||
return nil | |||
} | |||
|
|||
func (b *Block) GetNestedAttribute(name string) *Attribute { | |||
func (b *Block) GetNestedAttribute(name string) (*Attribute, *Block) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this function returns the parent attribute block for more accurate metadata output.
nikpivkin
changed the title
fix: check if SSE configuration block is nil
fix(terraform): check if SSE configuration block is nil
Sep 19, 2023
simar7
approved these changes
Sep 19, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See aquasecurity/trivy#5080