From 17337dfc7271f94b05d11c1c7b25152c4ac8abd9 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Tue, 12 Nov 2024 13:14:43 -0800 Subject: [PATCH 1/6] add debugging --- app/clients/sms/aws_sns.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/clients/sms/aws_sns.py b/app/clients/sms/aws_sns.py index 8b5d6c963..cc891c031 100644 --- a/app/clients/sms/aws_sns.py +++ b/app/clients/sms/aws_sns.py @@ -64,11 +64,15 @@ class AwsSnsClient(SmsClient): } if self._valid_sender_number(sender): + self.current_app.logger.info("aws_sns found a valid sender number!") attributes["AWS.MM.SMS.OriginationNumber"] = { "DataType": "String", "StringValue": sender, } else: + self.current_app.logger.info( + "aws_sns did not find a valid sender number, defaulting to the toll free one" + ) attributes["AWS.MM.SMS.OriginationNumber"] = { "DataType": "String", "StringValue": self.current_app.config["AWS_US_TOLL_FREE_NUMBER"], From 767f94a26c3f295307451fee0bff19d69d8ddf0c Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Tue, 12 Nov 2024 13:18:05 -0800 Subject: [PATCH 2/6] add debugging --- app/clients/sms/aws_sns.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/clients/sms/aws_sns.py b/app/clients/sms/aws_sns.py index cc891c031..ed08ef5df 100644 --- a/app/clients/sms/aws_sns.py +++ b/app/clients/sms/aws_sns.py @@ -64,7 +64,13 @@ class AwsSnsClient(SmsClient): } if self._valid_sender_number(sender): - self.current_app.logger.info("aws_sns found a valid sender number!") + self.current_app.logger.info( + "aws_sns found a valid sender number here it is wait for it!" + ) + # To defeat scrubbing, sender numbers are not PII. + for number in sender: + self.current_app.logger.info(number) + attributes["AWS.MM.SMS.OriginationNumber"] = { "DataType": "String", "StringValue": sender, From 5cd0e1e523e7e9dbc6d0ada08b5ff10550edc60a Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Tue, 12 Nov 2024 13:29:59 -0800 Subject: [PATCH 3/6] put number all on one line --- app/clients/sms/aws_sns.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/clients/sms/aws_sns.py b/app/clients/sms/aws_sns.py index ed08ef5df..ddc0629cb 100644 --- a/app/clients/sms/aws_sns.py +++ b/app/clients/sms/aws_sns.py @@ -68,8 +68,8 @@ class AwsSnsClient(SmsClient): "aws_sns found a valid sender number here it is wait for it!" ) # To defeat scrubbing, sender numbers are not PII. - for number in sender: - self.current_app.logger.info(number) + non_scrubbable = " ".join(sender) + self.current_app.logger.info(non_scrubbable) attributes["AWS.MM.SMS.OriginationNumber"] = { "DataType": "String", From 2a8b1374b03caf9adeb12b3de84d0a5a2c6c0373 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Tue, 12 Nov 2024 14:40:18 -0800 Subject: [PATCH 4/6] put number all on one line --- app/clients/sms/aws_sns.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/clients/sms/aws_sns.py b/app/clients/sms/aws_sns.py index ddc0629cb..ddd406590 100644 --- a/app/clients/sms/aws_sns.py +++ b/app/clients/sms/aws_sns.py @@ -63,13 +63,15 @@ class AwsSnsClient(SmsClient): } } + non_scrubbable = " ".join(sender) + default_num = " ".join(self.current_app.config["AWS_US_TOLL_FREE_NUMBER"]) + self.current_app.logger.info( + f"notify-api-1385 sender {non_scrubbable} is a {type(sender)} default is a {type(default_num)}" + ) if self._valid_sender_number(sender): self.current_app.logger.info( - "aws_sns found a valid sender number here it is wait for it!" + f"notify-api-1385 use valid sender {non_scrubbable} instead of default {default_num}" ) - # To defeat scrubbing, sender numbers are not PII. - non_scrubbable = " ".join(sender) - self.current_app.logger.info(non_scrubbable) attributes["AWS.MM.SMS.OriginationNumber"] = { "DataType": "String", @@ -77,8 +79,9 @@ class AwsSnsClient(SmsClient): } else: self.current_app.logger.info( - "aws_sns did not find a valid sender number, defaulting to the toll free one" + f"notify-api-1385 use default {default_num} instead of invalid sender {non_scrubbable}" ) + attributes["AWS.MM.SMS.OriginationNumber"] = { "DataType": "String", "StringValue": self.current_app.config["AWS_US_TOLL_FREE_NUMBER"], From 151ea31f6366b121021379d0a2d5e480acaa648b Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Tue, 12 Nov 2024 15:09:18 -0800 Subject: [PATCH 5/6] put number all on one line --- app/clients/sms/aws_sns.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/clients/sms/aws_sns.py b/app/clients/sms/aws_sns.py index ddd406590..79a1ce471 100644 --- a/app/clients/sms/aws_sns.py +++ b/app/clients/sms/aws_sns.py @@ -63,11 +63,18 @@ class AwsSnsClient(SmsClient): } } - non_scrubbable = " ".join(sender) - default_num = " ".join(self.current_app.config["AWS_US_TOLL_FREE_NUMBER"]) - self.current_app.logger.info( - f"notify-api-1385 sender {non_scrubbable} is a {type(sender)} default is a {type(default_num)}" - ) + if isinstance(sender, str): + non_scrubbable = " ".join(sender) + default_num = " ".join( + self.current_app.config["AWS_US_TOLL_FREE_NUMBER"] + ) + self.current_app.logger.info( + f"notify-api-1385 sender {non_scrubbable} is a {type(sender)} default is a {type(default_num)}" + ) + else: + self.current_app.logger.warning( + f"notify-api-1385 sender is type {type(sender)}!! {sender}" + ) if self._valid_sender_number(sender): self.current_app.logger.info( f"notify-api-1385 use valid sender {non_scrubbable} instead of default {default_num}" @@ -79,7 +86,7 @@ class AwsSnsClient(SmsClient): } else: self.current_app.logger.info( - f"notify-api-1385 use default {default_num} instead of invalid sender {non_scrubbable}" + f"notify-api-1385 use default {default_num} instead of invalid sender" ) attributes["AWS.MM.SMS.OriginationNumber"] = { From 312ae5e89ecf0f172d1a6d422c0c1314724dc497 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Tue, 12 Nov 2024 15:19:52 -0800 Subject: [PATCH 6/6] put number all on one line --- app/clients/sms/aws_sns.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/clients/sms/aws_sns.py b/app/clients/sms/aws_sns.py index 79a1ce471..d36af600c 100644 --- a/app/clients/sms/aws_sns.py +++ b/app/clients/sms/aws_sns.py @@ -63,11 +63,10 @@ class AwsSnsClient(SmsClient): } } + default_num = " ".join(self.current_app.config["AWS_US_TOLL_FREE_NUMBER"]) if isinstance(sender, str): non_scrubbable = " ".join(sender) - default_num = " ".join( - self.current_app.config["AWS_US_TOLL_FREE_NUMBER"] - ) + self.current_app.logger.info( f"notify-api-1385 sender {non_scrubbable} is a {type(sender)} default is a {type(default_num)}" )