generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: enable blocking of calls to unauthorized endpoints #613
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Production: terraform✅ Terraform Init: Plan: 1 to add, 2 to change, 0 to destroy Show summary
Show planResource actions are indicated with the following symbols:
+ create
~ update in-place
Terraform will perform the following actions:
# aws_iam_role.sre-bot will be updated in-place
~ resource "aws_iam_role" "sre-bot" {
~ assume_role_policy = jsonencode(
~ {
~ Statement = [
~ {
~ Principal = {
- AWS = "arn:aws:sts::283582579564:assumed-role/AWSReservedSSO_AWSAdministratorAccess_fdd017a84f0012e7/[email protected]" -> null
# (1 unchanged element hidden)
}
# (2 unchanged elements hidden)
},
]
# (1 unchanged element hidden)
}
)
id = "sre-bot-ecs-role"
name = "sre-bot-ecs-role"
tags = {
"CostCentre" = "sre-bot"
}
# (8 unchanged attributes hidden)
# (1 unchanged block hidden)
}
# aws_wafv2_web_acl.sre-bot will be updated in-place
~ resource "aws_wafv2_web_acl" "sre-bot" {
id = "2ea5ee5d-d7d8-46a4-a0a4-f59b67bd4c44"
name = "sre-bot"
tags = {
"Name" = "sre-bot"
}
# (7 unchanged attributes hidden)
+ rule {
+ name = "AuthorizedEndpoints"
+ priority = 6
+ action {
+ block {
}
}
+ statement {
+ and_statement {
+ statement {
+ not_statement {
+ statement {
+ byte_match_statement {
+ positional_constraint = "STARTS_WITH"
+ search_string = "/login"
+ field_to_match {
+ uri_path {}
}
+ text_transformation {
+ priority = 0
+ type = "NORMALIZE_PATH"
}
}
}
}
}
+ statement {
+ not_statement {
+ statement {
+ byte_match_statement {
+ positional_constraint = "STARTS_WITH"
+ search_string = "/logout"
+ field_to_match {
+ uri_path {}
}
+ text_transformation {
+ priority = 0
+ type = "NONE"
}
}
}
}
}
+ statement {
+ not_statement {
+ statement {
+ byte_match_statement {
+ positional_constraint = "STARTS_WITH"
+ search_string = "/auth"
+ field_to_match {
+ uri_path {}
}
+ text_transformation {
+ priority = 0
+ type = "NONE"
}
}
}
}
}
+ statement {
+ not_statement {
+ statement {
+ byte_match_statement {
+ positional_constraint = "STARTS_WITH"
+ search_string = "/geolocate"
+ field_to_match {
+ uri_path {}
}
+ text_transformation {
+ priority = 0
+ type = "NONE"
}
}
}
}
}
+ statement {
+ not_statement {
+ statement {
+ byte_match_statement {
+ positional_constraint = "STARTS_WITH"
+ search_string = "/hook"
+ field_to_match {
+ uri_path {}
}
+ text_transformation {
+ priority = 0
+ type = "NONE"
}
}
}
}
}
+ statement {
+ not_statement {
+ statement {
+ byte_match_statement {
+ positional_constraint = "STARTS_WITH"
+ search_string = "/version"
+ field_to_match {
+ uri_path {}
}
+ text_transformation {
+ priority = 0
+ type = "NONE"
}
}
}
}
}
}
}
+ visibility_config {
+ cloudwatch_metrics_enabled = true
+ metric_name = "AuthorizedEndpoints"
+ sampled_requests_enabled = true
}
}
- rule {
- name = "AuthorizedEndpoints" -> null
- priority = 6 -> null
- action {
- count {
}
}
- statement {
- and_statement {
- statement {
- not_statement {
- statement {
- byte_match_statement {
- positional_constraint = "STARTS_WITH" -> null
- search_string = "/login" -> null
- field_to_match {
- uri_path {}
}
- text_transformation {
- priority = 0 -> null
- type = "NORMALIZE_PATH" -> null
}
}
}
}
}
- statement {
- not_statement {
- statement {
- byte_match_statement {
- positional_constraint = "STARTS_WITH" -> null
- search_string = "/logout" -> null
- field_to_match {
- uri_path {}
}
- text_transformation {
- priority = 0 -> null
- type = "NONE" -> null
}
}
}
}
}
- statement {
- not_statement {
- statement {
- byte_match_statement {
- positional_constraint = "STARTS_WITH" -> null
- search_string = "/auth" -> null
- field_to_match {
- uri_path {}
}
- text_transformation {
- priority = 0 -> null
- type = "NONE" -> null
}
}
}
}
}
- statement {
- not_statement {
- statement {
- byte_match_statement {
- positional_constraint = "STARTS_WITH" -> null
- search_string = "/geolocate" -> null
- field_to_match {
- uri_path {}
}
- text_transformation {
- priority = 0 -> null
- type = "NONE" -> null
}
}
}
}
}
- statement {
- not_statement {
- statement {
- byte_match_statement {
- positional_constraint = "STARTS_WITH" -> null
- search_string = "/hook" -> null
- field_to_match {
- uri_path {}
}
- text_transformation {
- priority = 0 -> null
- type = "NONE" -> null
}
}
}
}
}
- statement {
- not_statement {
- statement {
- byte_match_statement {
- positional_constraint = "STARTS_WITH" -> null
- search_string = "/version" -> null
- field_to_match {
- uri_path {}
}
- text_transformation {
- priority = 0 -> null
- type = "NONE" -> null
}
}
}
}
}
}
}
- visibility_config {
- cloudwatch_metrics_enabled = true -> null
- metric_name = "AuthorizedEndpoints" -> null
- sampled_requests_enabled = true -> null
}
}
- rule {
- name = "AWS-AWSManagedRulesAmazonIpReputationList" -> null
- priority = 4 -> null
- override_action {
- none {}
}
- statement {
- managed_rule_group_statement {
- name = "AWSManagedRulesAmazonIpReputationList" -> null
- vendor_name = "AWS" -> null
}
}
- visibility_config {
- cloudwatch_metrics_enabled = true -> null
- metric_name = "AWS-AWSManagedRulesAmazonIpReputationList" -> null
- sampled_requests_enabled = true -> null
}
}
+ rule {
+ name = "AWS-AWSManagedRulesAmazonIpReputationList"
+ priority = 4
+ override_action {
+ none {}
}
+ statement {
+ managed_rule_group_statement {
+ name = "AWSManagedRulesAmazonIpReputationList"
+ vendor_name = "AWS"
}
}
+ visibility_config {
+ cloudwatch_metrics_enabled = true
+ metric_name = "AWS-AWSManagedRulesAmazonIpReputationList"
+ sampled_requests_enabled = true
}
}
- rule {
- name = "AWS-AWSManagedRulesCommonRuleSet" -> null
- priority = 1 -> null
- override_action {
- none {}
}
- statement {
- managed_rule_group_statement {
- name = "AWSManagedRulesCommonRuleSet" -> null
- vendor_name = "AWS" -> null
}
}
- visibility_config {
- cloudwatch_metrics_enabled = true -> null
- metric_name = "AWS-AWSManagedRulesCommonRuleSet" -> null
- sampled_requests_enabled = true -> null
}
}
+ rule {
+ name = "AWS-AWSManagedRulesCommonRuleSet"
+ priority = 1
+ override_action {
+ none {}
}
+ statement {
+ managed_rule_group_statement {
+ name = "AWSManagedRulesCommonRuleSet"
+ vendor_name = "AWS"
}
}
+ visibility_config {
+ cloudwatch_metrics_enabled = true
+ metric_name = "AWS-AWSManagedRulesCommonRuleSet"
+ sampled_requests_enabled = true
}
}
- rule {
- name = "AWS-AWSManagedRulesKnownBadInputsRuleSet" -> null
- priority = 2 -> null
- override_action {
- none {}
}
- statement {
- managed_rule_group_statement {
- name = "AWSManagedRulesKnownBadInputsRuleSet" -> null
- vendor_name = "AWS" -> null
}
}
- visibility_config {
- cloudwatch_metrics_enabled = true -> null
- metric_name = "AWS-AWSManagedRulesKnownBadInputsRuleSet" -> null
- sampled_requests_enabled = true -> null
}
}
+ rule {
+ name = "AWS-AWSManagedRulesKnownBadInputsRuleSet"
+ priority = 2
+ override_action {
+ none {}
}
+ statement {
+ managed_rule_group_statement {
+ name = "AWSManagedRulesKnownBadInputsRuleSet"
+ vendor_name = "AWS"
}
}
+ visibility_config {
+ cloudwatch_metrics_enabled = true
+ metric_name = "AWS-AWSManagedRulesKnownBadInputsRuleSet"
+ sampled_requests_enabled = true
}
}
- rule {
- name = "AWSManagedRulesLinuxRuleSet" -> null
- priority = 3 -> null
- override_action {
- none {}
}
- statement {
- managed_rule_group_statement {
- name = "AWSManagedRulesLinuxRuleSet" -> null
- vendor_name = "AWS" -> null
}
}
- visibility_config {
- cloudwatch_metrics_enabled = true -> null
- metric_name = "AWSManagedRulesLinuxRuleSet" -> null
- sampled_requests_enabled = true -> null
}
}
+ rule {
+ name = "AWSManagedRulesLinuxRuleSet"
+ priority = 3
+ override_action {
+ none {}
}
+ statement {
+ managed_rule_group_statement {
+ name = "AWSManagedRulesLinuxRuleSet"
+ vendor_name = "AWS"
}
}
+ visibility_config {
+ cloudwatch_metrics_enabled = true
+ metric_name = "AWSManagedRulesLinuxRuleSet"
+ sampled_requests_enabled = true
}
}
# (5 unchanged blocks hidden)
}
# aws_wafv2_web_acl_logging_configuration.sre-bot will be created
+ resource "aws_wafv2_web_acl_logging_configuration" "sre-bot" {
+ id = (known after apply)
+ log_destination_configs = [
+ "arn:aws:logs:ca-central-1:283582579564:log-group:sre-bot-waf-log-group",
]
+ resource_arn = "arn:aws:wafv2:ca-central-1:283582579564:regional/webacl/sre-bot/2ea5ee5d-d7d8-46a4-a0a4-f59b67bd4c44"
}
Plan: 1 to add, 2 to change, 0 to destroy.
Warning: Argument is deprecated
with module.sre_bot_bucket.aws_s3_bucket.this,
on .terraform/modules/sre_bot_bucket/S3/main.tf line 8, in resource "aws_s3_bucket" "this":
8: resource "aws_s3_bucket" "this" {
Use the aws_s3_bucket_server_side_encryption_configuration resource instead
(and 6 more similar warnings elsewhere)
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Show Conftest resultsWARN - plan.json - main - Missing Common Tags: ["aws_acm_certificate.sre_bot"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.sre-bot_group"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.sre_bot_dns"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.sre_bot_waf_log_group"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.sre_bot_error"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.sre_bot_warning"]
WARN - plan.json - main - Missing Common Tags: ["aws_dynamodb_table.aws_access_requests_table"]
WARN - plan.json - main - Missing Common Tags: ["aws_dynamodb_table.sre_bot_data"]
WARN - plan.json - main - Missing Common Tags: ["aws_dynamodb_table.webhooks_table"]
WARN - plan.json - main - Missing Common Tags: ["aws_ecr_repository.sre-bot"]
WARN - plan.json - main - Missing Common Tags: ["aws_ecs_cluster.sre-bot"]
WARN - plan.json - main - Missing Common Tags: ["aws_ecs_service.main"]
WARN - plan.json - main - Missing Common Tags: ["aws_ecs_task_definition.sre-bot"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.geodb_refresh_policy"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.sre-bot_secrets_manager"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.sre_bot_bucket"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_role.sre-bot"]
WARN - plan.json - main - Missing Common Tags: ["aws_lb.sre_bot"]
WARN - plan.json - main - Missing Common Tags: ["aws_lb_listener.sre_bot_listener"]
WARN - plan.json - main - Missing Common Tags: ["aws_lb_target_group.sre_bot"]
WARN - plan.json - main - Missing Common Tags: ["aws_route53_health_check.sre_bot_healthcheck"]
WARN - plan.json - main - Missing Common Tags: ["aws_route53_resolver_query_log_config.sre_bot"]
WARN - plan.json - main - Missing Common Tags: ["aws_route53_zone.sre_bot"]
WARN - plan.json - main - Missing Common Tags:... |
patheard
approved these changes
Aug 6, 2024
sylviamclaughlin
approved these changes
Aug 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary | Résumé
Enable blocking calls to unauthorized endpoints