2021-05-21 17:48:13 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
|
|
|
|
include::../recommended.adoc[]
|
|
|
|
|
|
|
|
== Sensitive Code Example
|
|
|
|
|
|
|
|
No secure policy is attached to this S3 bucket:
|
|
|
|
|
2023-05-05 11:12:16 +02:00
|
|
|
[source,yaml]
|
2021-05-21 17:48:13 +02:00
|
|
|
----
|
|
|
|
AWSTemplateFormatVersion: 2010-09-09
|
|
|
|
Resources:
|
|
|
|
S3Bucket:
|
|
|
|
Type: 'AWS::S3::Bucket' # Sensitive
|
|
|
|
----
|
2022-02-22 18:09:50 +01:00
|
|
|
|
|
|
|
A policy is defined but forces only HTTPs communication for some users:
|
2021-05-21 17:48:13 +02:00
|
|
|
|
2023-05-05 11:12:16 +02:00
|
|
|
[source,yaml]
|
2021-05-21 17:48:13 +02:00
|
|
|
----
|
|
|
|
AWSTemplateFormatVersion: 2010-09-09
|
|
|
|
Resources:
|
|
|
|
S3Bucket:
|
|
|
|
Type: 'AWS::S3::Bucket' # Sensitive
|
|
|
|
Properties:
|
2022-04-06 14:44:06 +02:00
|
|
|
BucketName: "mynoncompliantbucket"
|
2021-05-21 17:48:13 +02:00
|
|
|
|
|
|
|
S3BucketPolicy:
|
|
|
|
Type: 'AWS::S3::BucketPolicy'
|
|
|
|
Properties:
|
|
|
|
Bucket: !Ref S3Bucket
|
|
|
|
PolicyDocument:
|
|
|
|
Version: "2012-10-17"
|
|
|
|
Statement:
|
|
|
|
- Effect: Deny
|
|
|
|
Principal:
|
2022-04-06 14:44:06 +02:00
|
|
|
AWS: # Sensitive: only one principal is forced to use https
|
2021-05-21 17:48:13 +02:00
|
|
|
- 'arn:aws:iam::123456789123:root'
|
|
|
|
Action: "*"
|
2022-04-06 14:44:06 +02:00
|
|
|
Resource: arn:aws:s3:::mynoncompliantbuckets6249/*
|
2021-05-21 17:48:13 +02:00
|
|
|
Condition:
|
|
|
|
Bool:
|
|
|
|
"aws:SecureTransport": false
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
A secure policy that denies the use of all HTTP requests:
|
|
|
|
|
2023-05-05 11:12:16 +02:00
|
|
|
[source,yaml]
|
2021-05-21 17:48:13 +02:00
|
|
|
----
|
|
|
|
AWSTemplateFormatVersion: 2010-09-09
|
|
|
|
Resources:
|
|
|
|
S3Bucket:
|
|
|
|
Type: 'AWS::S3::Bucket' # Compliant
|
|
|
|
Properties:
|
2022-04-06 14:44:06 +02:00
|
|
|
BucketName: "mycompliantbucket"
|
2021-05-21 17:48:13 +02:00
|
|
|
|
|
|
|
S3BucketPolicy:
|
|
|
|
Type: 'AWS::S3::BucketPolicy'
|
|
|
|
Properties:
|
2022-04-06 14:44:06 +02:00
|
|
|
Bucket: "mycompliantbucket"
|
2021-05-21 17:48:13 +02:00
|
|
|
PolicyDocument:
|
|
|
|
Version: "2012-10-17"
|
|
|
|
Statement:
|
|
|
|
- Effect: Deny
|
|
|
|
Principal:
|
|
|
|
AWS: "*" # all principals should use https
|
|
|
|
Action: "*" # for any actions
|
2022-04-06 14:44:06 +02:00
|
|
|
Resource: arn:aws:s3:::mycompliantbucket/* # for any resources
|
2021-05-21 17:48:13 +02:00
|
|
|
Condition:
|
|
|
|
Bool:
|
|
|
|
"aws:SecureTransport": false
|
|
|
|
----
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|