latest run 54 pass 0 fail 0 skipevidence →
HKB Operations: pages
HKB OperationsKnowledge space

Starred pages

Pages

Page directory · Labels · [ hides this

GR-05

S3 baseline. Block Public Access on, SSE-KMS, and a bucket policy that denies non-TLS requests.

Property Value
Runs on Every CloudFormation template, in CI on each change and in the pipeline's Validate stage
Source guard/rules/gr-05-s3-baseline.guard
Exceptions none

Rule text

# GR-05: S3 baseline. Block Public Access on, SSE-KMS, and a bucket policy that denies non-TLS requests.
let buckets = Resources.*[ Type == 'AWS::S3::Bucket' ]
let policies = Resources.*[ Type == 'AWS::S3::BucketPolicy' ]
# SSE-KMS on every bucket but one that names GR_05_sse_kms in Metadata.guard.SuppressedRules, with a
# guard/exceptions.yaml entry: S3 server access logs deliver only to SSE-S3 buckets (DQ-166)
let kms_buckets = Resources.*[
  Type == 'AWS::S3::Bucket'
  Metadata.guard.SuppressedRules not exists or Metadata.guard.SuppressedRules[*] != 'GR_05_sse_kms'
]

rule GR_05_bucket when %buckets !empty {
  %buckets {
    Properties.PublicAccessBlockConfiguration.BlockPublicAcls == true       <<GR-05: BlockPublicAcls must be true>>
    Properties.PublicAccessBlockConfiguration.BlockPublicPolicy == true     <<GR-05: BlockPublicPolicy must be true>>
    Properties.PublicAccessBlockConfiguration.IgnorePublicAcls == true      <<GR-05: IgnorePublicAcls must be true>>
    Properties.PublicAccessBlockConfiguration.RestrictPublicBuckets == true <<GR-05: RestrictPublicBuckets must be true>>
  }
}

rule GR_05_sse_kms when %kms_buckets !empty {
  %kms_buckets {
    Properties.BucketEncryption.ServerSideEncryptionConfiguration[*].ServerSideEncryptionByDefault.SSEAlgorithm == 'aws:kms'
      <<GR-05: default encryption must be SSE-KMS>>
  }
}

# Every bucket policy must contain a Deny on aws:SecureTransport false.
rule GR_05_tls when %policies !empty {
  %policies {
    some Properties.PolicyDocument.Statement[*] {
      Effect == 'Deny'
      Condition.Bool."aws:SecureTransport" == 'false'
    }
  }
}

# Every bucket needs a policy resource. Checked by count: buckets without any policy fail.
rule GR_05_policy_exists when %buckets !empty {
  %policies !empty <<GR-05: a bucket exists but no AWS::S3::BucketPolicy denies non-TLS requests>>
}

Page information

Owner
Security Engineering
Status
current Current: generated from the templates and records in the repository at this build.
Generated from
guard/rules/gr-05-s3-baseline.guard
Linked from
Controls, Template rules
Plain markdown
/wiki/guard/gr-05/index.md