From 5c65fb2b4c7ae942c3cbb4f054e2fabb8340a889 Mon Sep 17 00:00:00 2001 From: jamesthompson26-nhs Date: Mon, 14 Jul 2025 15:05:35 +0100 Subject: [PATCH 1/2] CCM-11097: Event Validation --- .../eventpub/lambda/eventpub/src/index.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/infrastructure/modules/eventpub/lambda/eventpub/src/index.js b/infrastructure/modules/eventpub/lambda/eventpub/src/index.js index 742f653..d0cfc8a 100644 --- a/infrastructure/modules/eventpub/lambda/eventpub/src/index.js +++ b/infrastructure/modules/eventpub/lambda/eventpub/src/index.js @@ -30,22 +30,6 @@ function validateEvent(event) { if (!requiredFields.every(field => event.hasOwnProperty(field))) { return false; } - // Check nested data object and its required fields - const dataRequiredFields = [ - 'nhsNumber', - 'delayedFallback', - 'sendingGroupId', - 'clientId', - 'campaignId', - 'supplierStatus', - 'previousSupplierStatus' - ]; - if ( - typeof event.data !== 'object' || - !dataRequiredFields.every(field => event.data.hasOwnProperty(field)) - ) { - return false; - } return true; } From fb8d9174629ad8acb6c2e15667fa49b1f15b628f Mon Sep 17 00:00:00 2001 From: jamesthompson26-nhs Date: Mon, 14 Jul 2025 15:25:56 +0100 Subject: [PATCH 2/2] CCM-11097: Event Validation --- .../lambda/cloudwatch_log_subscription_filter_firehose.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/modules/lambda/cloudwatch_log_subscription_filter_firehose.tf b/infrastructure/modules/lambda/cloudwatch_log_subscription_filter_firehose.tf index 0e026da..cdf0605 100644 --- a/infrastructure/modules/lambda/cloudwatch_log_subscription_filter_firehose.tf +++ b/infrastructure/modules/lambda/cloudwatch_log_subscription_filter_firehose.tf @@ -1,6 +1,6 @@ resource "aws_cloudwatch_log_subscription_filter" "firehose" { count = var.send_to_firehose ? 1 : 0 # Keeping this optional for now as don't want to break all lambdas using this, can make this mandatory later - name = replace(aws_cloudwatch_log_group.main.name, "/", "-") + name = trim(replace(aws_cloudwatch_log_group.main.name, "/", "-"), "-") log_group_name = aws_cloudwatch_log_group.main.name filter_pattern = var.filter_pattern destination_arn = var.log_destination_arn