2021-05-21 18:34:30 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
|
|
|
|
include::../recommended.adoc[]
|
|
|
|
|
|
|
|
== Sensitive Code Example
|
|
|
|
|
|
|
|
By default, when not set, the ``++PublicAccessBlockConfiguration++`` is fully deactivated (nothing is blocked):
|
|
|
|
|
2023-05-05 11:12:16 +02:00
|
|
|
[source,yaml]
|
2021-05-21 18:34:30 +02:00
|
|
|
----
|
|
|
|
AWSTemplateFormatVersion: 2010-09-09
|
|
|
|
Resources:
|
|
|
|
S3Bucketdefault:
|
|
|
|
Type: 'AWS::S3::Bucket' # Sensitive
|
|
|
|
Properties:
|
2022-03-25 14:41:52 +01:00
|
|
|
BucketName: "example"
|
2021-05-21 18:34:30 +02:00
|
|
|
----
|
|
|
|
|
|
|
|
This ``++PublicAccessBlockConfiguration++`` allows public ACL to be set:
|
|
|
|
|
2023-05-05 11:12:16 +02:00
|
|
|
[source,yaml]
|
2021-05-21 18:34:30 +02:00
|
|
|
----
|
|
|
|
AWSTemplateFormatVersion: 2010-09-09
|
|
|
|
Resources:
|
|
|
|
S3Bucket:
|
|
|
|
Type: 'AWS::S3::Bucket' # Sensitive
|
|
|
|
Properties:
|
2022-03-25 14:41:52 +01:00
|
|
|
BucketName: "example"
|
2021-05-21 18:34:30 +02:00
|
|
|
PublicAccessBlockConfiguration:
|
|
|
|
BlockPublicAcls: false # should be true
|
|
|
|
BlockPublicPolicy: true
|
|
|
|
IgnorePublicAcls: true
|
|
|
|
RestrictPublicBuckets: true
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
This ``++PublicAccessBlockConfiguration++`` blocks public ACLs and policies, ignores existing public ACLs and restricts existing public policies:
|
|
|
|
|
2023-05-05 11:12:16 +02:00
|
|
|
[source,yaml]
|
2021-05-21 18:34:30 +02:00
|
|
|
----
|
|
|
|
AWSTemplateFormatVersion: 2010-09-09
|
|
|
|
Resources:
|
|
|
|
S3Bucket:
|
|
|
|
Type: 'AWS::S3::Bucket' # Compliant
|
|
|
|
Properties:
|
2022-03-25 14:41:52 +01:00
|
|
|
BucketName: "example"
|
2021-05-21 18:34:30 +02:00
|
|
|
PublicAccessBlockConfiguration:
|
|
|
|
BlockPublicAcls: true
|
|
|
|
BlockPublicPolicy: true
|
|
|
|
IgnorePublicAcls: true
|
|
|
|
RestrictPublicBuckets: true
|
|
|
|
----
|
|
|
|
|
|
|
|
include::../see.adoc[]
|
2023-06-22 10:38:01 +02:00
|
|
|
|
2021-09-20 15:38:42 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
=== Message
|
|
|
|
|
|
|
|
* Primary locations
|
|
|
|
** Make sure allowing public ACL/policies to be set is safe here.
|
|
|
|
** Omitting "PublicAccessBlockConfiguration" allows public ACL/policies to be set on this S3 bucket. Make sure it is safe here.
|
|
|
|
* Secondary location
|
|
|
|
** Set this property to true
|
|
|
|
|
|
|
|
|
|
|
|
=== Highlighting
|
|
|
|
|
|
|
|
* Primary locations
|
|
|
|
** PublicAccessBlockConfiguration property
|
|
|
|
** AWS::S3::Bucket resource
|
|
|
|
* Secondary location
|
|
|
|
** BlockPublicAcls / BlockPublicPolicy / IgnorePublicAcls / RestrictPublicBuckets properties set to false
|
2022-03-25 14:41:52 +01:00
|
|
|
|
2021-09-20 15:38:42 +02:00
|
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|