Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions eventbridge-webhooks/1-stripe/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import base64
import hmac
import hashlib
from cgi import parse_header
import boto3
import botocore
import botocore.session
Expand Down Expand Up @@ -200,7 +199,7 @@ def get_content_type(headers):

if raw_content_type is None:
return None
content_type, _ = parse_header(raw_content_type)
content_type = raw_content_type.split(';')[0].strip()
return content_type


Expand Down
3 changes: 2 additions & 1 deletion eventbridge-webhooks/1-stripe/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
boto3
boto3
aws-secretsmanager-caching
3 changes: 1 addition & 2 deletions eventbridge-webhooks/2-github/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import base64
import hmac
import hashlib
from cgi import parse_header
import boto3
import botocore
import botocore.session
Expand Down Expand Up @@ -160,7 +159,7 @@ def get_content_type(headers):

if raw_content_type is None:
return None
content_type, _ = parse_header(raw_content_type)
content_type = raw_content_type.split(';')[0].strip()
return content_type


Expand Down
3 changes: 2 additions & 1 deletion eventbridge-webhooks/2-github/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
boto3
boto3
aws-secretsmanager-caching
7 changes: 3 additions & 4 deletions eventbridge-webhooks/3-twilio/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import hmac
import hashlib
from functools import reduce
from cgi import parse_header
import boto3
import botocore
import botocore.session
Expand All @@ -18,7 +17,7 @@
cache_config = SecretCacheConfig()
cache = SecretCache(config=cache_config, client=client)

github_webhook_secret_arn = os.environ.get('TWILIO_WEBHOOK_SECRET_ARN')
twilio_webhook_secret_arn = os.environ.get('TWILIO_WEBHOOK_SECRET_ARN')
event_bus_name = os.environ.get('EVENT_BUS_NAME', 'default')

event_bridge_client = boto3.client('events')
Expand Down Expand Up @@ -114,7 +113,7 @@ def contains_valid_signature(payload_object, url, event_signature):
"""Check for the payload signature
Twilio documentation: https://www.twilio.com/docs/usage/webhooks/webhooks-security#validating-signatures-from-twilio
"""
secret = cache.get_secret_string(github_webhook_secret_arn)
secret = cache.get_secret_string(twilio_webhook_secret_arn)
payload_bytes = get_payload_bytes(
url=url,
payload_object=payload_object
Expand Down Expand Up @@ -166,7 +165,7 @@ def get_content_type(headers):

if raw_content_type is None:
return None
content_type, _ = parse_header(raw_content_type)
content_type = raw_content_type.split(';')[0].strip()
return content_type


Expand Down
3 changes: 2 additions & 1 deletion eventbridge-webhooks/3-twilio/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
boto3
boto3
aws-secretsmanager-caching