mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
Merge pull request #1425 from alphagov/enable-firetext-inbound-sms-auth
Abort unauthenticated requests for Firetext inbound SMS
This commit is contained in:
@@ -60,10 +60,10 @@ def receive_firetext_sms():
|
|||||||
auth = request.authorization
|
auth = request.authorization
|
||||||
if not auth:
|
if not auth:
|
||||||
current_app.logger.warning("Inbound sms no auth header")
|
current_app.logger.warning("Inbound sms no auth header")
|
||||||
# abort(401)
|
abort(401)
|
||||||
elif auth.username != 'notify' or auth.password not in current_app.config['FIRETEXT_INBOUND_SMS_AUTH']:
|
elif auth.username != 'notify' or auth.password not in current_app.config['FIRETEXT_INBOUND_SMS_AUTH']:
|
||||||
current_app.logger.warning("Inbound sms incorrect username ({}) or password".format(auth.username))
|
current_app.logger.warning("Inbound sms incorrect username ({}) or password".format(auth.username))
|
||||||
# abort(403)
|
abort(403)
|
||||||
|
|
||||||
inbound_number = strip_leading_forty_four(post_data['destination'])
|
inbound_number = strip_leading_forty_four(post_data['destination'])
|
||||||
|
|
||||||
|
|||||||
@@ -400,7 +400,6 @@ def test_strip_leading_country_code(number, expected):
|
|||||||
["", [], 401],
|
["", [], 401],
|
||||||
["testkey", [], 403],
|
["testkey", [], 403],
|
||||||
])
|
])
|
||||||
@pytest.mark.skip(reason="aborts are disabled at the moment")
|
|
||||||
def test_firetext_inbound_sms_auth(notify_db_session, notify_api, client, mocker, auth, keys, status_code):
|
def test_firetext_inbound_sms_auth(notify_db_session, notify_api, client, mocker, auth, keys, status_code):
|
||||||
mocker.patch("app.notifications.receive_notifications.tasks.send_inbound_sms_to_service.apply_async")
|
mocker.patch("app.notifications.receive_notifications.tasks.send_inbound_sms_to_service.apply_async")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user