Skip to content

Commit

Permalink
Merge branch 'main' into 2159-negative-twilio-time
Browse files Browse the repository at this point in the history
  • Loading branch information
k-macmillan committed Dec 6, 2024
2 parents ee302b5 + c746363 commit fdb5c77
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
if DELIVERY_STATUS_RESULT_TASK_QUEUE_DEAD_LETTER is None:
sys.exit('A required environment variable is not set. Please set DELIVERY_STATUS_RESULT_TASK_QUEUE_DEAD_LETTER')

if TWILIO_AUTH_TOKEN_SSM_NAME is None or TWILIO_AUTH_TOKEN_SSM_NAME == 'DEFAULT':
if TWILIO_AUTH_TOKEN_SSM_NAME is None or TWILIO_AUTH_TOKEN_SSM_NAME == 'DEFAULT': # nosec
sys.exit('A required environment variable is not set. Please set TWILIO_AUTH_TOKEN_SSM_NAME')

sqs_client = boto3.client('sqs', region_name='us-gov-west-1')
Expand All @@ -47,15 +47,15 @@ def get_twilio_token() -> str:
@return: Twilio Token from SSM
"""
try:
if TWILIO_AUTH_TOKEN_SSM_NAME == 'unit_test':
if TWILIO_AUTH_TOKEN_SSM_NAME == 'unit_test': # nosec
return 'bad_twilio_auth'
ssm_client = boto3.client('ssm', 'us-gov-west-1')

response = ssm_client.get_parameter(Name=TWILIO_AUTH_TOKEN_SSM_NAME, WithDecryption=True)
return response.get('Parameter').get('Value')
except Exception as e:
logger.error('Failed to retrieve Twilio Auth with: %s', e)
return None
except Exception:
logger.exception('Failed to retrieve Twilio Auth token')
sys.exit('Delivery status lambda Execution Environment abort due to invalid response from SSM')


auth_token = get_twilio_token()
Expand Down

0 comments on commit fdb5c77

Please sign in to comment.