Skip to content

Conversation

kwood
Copy link

@kwood kwood commented Sep 7, 2023

Currently, this package validates that subscription requests are signed by AWS, but this allows any account on AWS to create a topic and start sending messages to an endpoint.

This is a potential security problem — if an attacker can discover the URL for an endpoint, they can create their own topics that write to them, and the subscription and subsequent messages will be accepted.

This PR creates a way to deny subscription requests that aren't coming from a known AWS account, configurable in the Django settings. It also introduces an easy way to customize this behavior, by overriding the should_confirm_subscription method.

If there's interest in merging this PR, I'd be happy to write some documentation for it.

Note that I had to remove the nose-tests dependency — that library is no longer maintained, and ./manage.py test works out of the box now.

"""
if hasattr(settings, 'AWS_ACCOUNT_ID'):
arn = payload['TopicArn'].split(':')[4]
print(arn)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: dont think this is necessary. Could use logger.debug otherwise

@deep-c
Copy link
Owner

deep-c commented Mar 18, 2025

Thanks kwood, this is indeed useful. Ive just opened a PR to update the repo based on a fork. If you could make your changes based on that branch we can merge it in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants