
When an include is not surrounded by empty lines, its content is inlined on the same line as the adjacent content. That can lead to broken tags and other display issues. This PR fixes all such includes and introduces a validation step that forbids introducing the same problem again.
71 lines
1.5 KiB
Plaintext
71 lines
1.5 KiB
Plaintext
include::../description.adoc[]
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
include::../recommended.adoc[]
|
|
|
|
== Sensitive Code Example
|
|
|
|
This policy allows all users, including anonymous ones, to access an S3 bucket:
|
|
|
|
----
|
|
resource "aws_s3_bucket_policy" "mynoncompliantpolicy" { # Sensitive
|
|
bucket = aws_s3_bucket.mybucket.id
|
|
policy = jsonencode({
|
|
Id = "mynoncompliantpolicy"
|
|
Version = "2012-10-17"
|
|
Statement = [{
|
|
Effect = "Allow"
|
|
Principal = {
|
|
AWS = "*"
|
|
}
|
|
Action = [
|
|
"s3:PutObject"
|
|
]
|
|
Resource: "${aws_s3_bucket.mybucket.arn}/*"
|
|
}
|
|
]
|
|
})
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
This policy allows only the authorized users:
|
|
|
|
[source,terraform]
|
|
----
|
|
resource "aws_s3_bucket_policy" "mycompliantpolicy" {
|
|
bucket = aws_s3_bucket.mybucket.id
|
|
policy = jsonencode({
|
|
Id = "mycompliantpolicy"
|
|
Version = "2012-10-17"
|
|
Statement = [{
|
|
Effect = "Allow"
|
|
Principal = {
|
|
AWS = [
|
|
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:root"
|
|
]
|
|
}
|
|
Action = [
|
|
"s3:PutObject"
|
|
]
|
|
Resource = "${aws_s3_bucket.mybucket.arn}/*"
|
|
}
|
|
]
|
|
})
|
|
}
|
|
----
|
|
|
|
include::../see.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|