From 12a99f9a7fa7d7287811e1f178d270d0b45b3eba Mon Sep 17 00:00:00 2001 From: venusbb Date: Fri, 17 Nov 2017 14:36:28 +0000 Subject: [PATCH 1/2] Verify authorisation header being send --- app/notifications/receive_notifications.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/notifications/receive_notifications.py b/app/notifications/receive_notifications.py index fa9d11146..bc46a8ed1 100644 --- a/app/notifications/receive_notifications.py +++ b/app/notifications/receive_notifications.py @@ -56,6 +56,10 @@ def receive_mmg_sms(): def receive_firetext_sms(): post_data = request.form + # This is a pre-implementation test code to validate the provider is sending through what they claim. + auth = request.authorization + current_app.logger.info("Inbound sms username: {}".format(auth.username)) + inbound_number = strip_leading_forty_four(post_data['destination']) service = fetch_potential_service(inbound_number, 'firetext') From d70fdbb5c290c205fd0a6370f7a4842d6b572cac Mon Sep 17 00:00:00 2001 From: venusbb Date: Fri, 17 Nov 2017 15:53:00 +0000 Subject: [PATCH 2/2] no auth check --- app/notifications/receive_notifications.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/notifications/receive_notifications.py b/app/notifications/receive_notifications.py index bc46a8ed1..4b6e2ebb8 100644 --- a/app/notifications/receive_notifications.py +++ b/app/notifications/receive_notifications.py @@ -56,9 +56,12 @@ def receive_mmg_sms(): def receive_firetext_sms(): post_data = request.form - # This is a pre-implementation test code to validate the provider is sending through what they claim. + # This is pre-implementation test code to validate the provider is basic auth headers. auth = request.authorization - current_app.logger.info("Inbound sms username: {}".format(auth.username)) + if auth: + current_app.logger.info("Inbound sms username: {}".format(auth.username)) + else: + current_app.logger.info("Inbound sms no auth header") inbound_number = strip_leading_forty_four(post_data['destination'])