Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2166 - Update Delivery Status Lambda SSM Processing #2167

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading