Skip to content

Commit

Permalink
spinecli 906 905 kms key rotation and s3bucket deny non https (#5)
Browse files Browse the repository at this point in the history
<!-- markdownlint-disable-next-line first-line-heading -->
## Description
Pen Test Security Fixes: Enable KMS Key Rotation and S3 Deny on
non-HTTPS traffic
<!-- Describe your changes in detail. -->

## Context

<!-- Why is this change required? What problem does it solve? -->
Pen Test Security Issues Resolved by this
## Type of changes

<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply. -->

- [x] Refactoring (non-breaking change)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would change existing
functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)

## Checklist

<!-- Go over all the following points, and put an `x` in all the boxes
that apply. -->

- [x] I am familiar with the [contributing
guidelines](../docs/CONTRIBUTING.md)
- [x] I have followed the code style of the project
- [x] I have added tests to cover my changes
- [x] I have updated the documentation accordingly
- [ ] This PR is a result of pair or mob programming

---

## Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others
privacy, we kindly ask you to NOT including [PII (Personal Identifiable
Information) / PID (Personal Identifiable
Data)](https://digital.nhs.uk/data-and-information/keeping-data-safe-and-benefitting-the-public)
or any other sensitive data in this PR (Pull Request) and the codebase
changes. We will remove any PR that do contain any sensitive
information. We really appreciate your cooperation in this matter.

- [x] I confirm that neither PII/PID nor sensitive data are included in
this PR and the codebase changes.
  • Loading branch information
eesa456 authored Aug 7, 2023
1 parent 4cc6060 commit 06a130e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/cloudfront-logs/kms.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ resource "aws_kms_key" "cloudwatch_logs_key" {
description = "KMS Key for ${var.log_group_name} log group"
deletion_window_in_days = 10
policy = data.aws_iam_policy_document.cloudwatch_logs_key_policy[0].json
enable_key_rotation = true
}

data "aws_iam_policy_document" "cloudwatch_logs_key_policy" {
Expand Down
16 changes: 16 additions & 0 deletions modules/opennext-assets/s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,22 @@ data "aws_iam_policy_document" "read_assets_bucket" {
identifiers = [var.server_function_role_arn]
}
}
statement {
effect = "Deny"
actions = ["s3:*"]
resources = [aws_s3_bucket.assets.arn, "${aws_s3_bucket.assets.arn}/*"]

condition {
test = "Bool"
values = ["false"]
variable = "aws:SecureTransport"
}

principals {
type = "*"
identifiers = ["*"]
}
}
}

# Static Assets
Expand Down
1 change: 1 addition & 0 deletions modules/opennext-revalidation-queue/kms.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ resource "aws_kms_key" "revalidation_queue_key" {
deletion_window_in_days = 10

policy = data.aws_iam_policy_document.revalidation_queue_key_policy[0].json
enable_key_rotation = true
}

data "aws_iam_policy_document" "revalidation_queue_key_policy" {
Expand Down

0 comments on commit 06a130e

Please sign in to comment.