AWS SNS Message Validator
PyPI: https://pypi.org/project/aws-sns-message-validator/
Motivation
An HTTP endpoint for AWS SNS needs to validate the received messages before processing them which involves some non-trivial logic, especially signature verification. In terms of implementation, AWS does not offer any help with SNS message validation in their SDK for Python (issue) nor does it provide example code in the documentation (example code is only available in Java). Therefore Python developers would need to invent their own wheels.
To solve this problem, this repository offers an SNS message validator which is implemented according to the guide on the official AWS documentation, and offers example code of how to use it to implement an HTTP endpoint for SNS.
Prerequisite
- Python >= 3.6
Install
pip install aws-sns-message-validator
Usage
Refer to the example code flask_example.py to see how to use this package in your SNS http endpoint. In order to quickly try out the example code, follow the steps below:
- Make sure you have Python>=3.6 installed. (Create a virtual environment if you want to.)
- Checkout this repo and install dev dependencies by
python3 -m pip install -r requirements.txt - Run
FLASK_APP=flask_example.py flask run --port=5000to start an http server. - Use
ngrokto expose the local server to the public internet (./ngrok http -bind-tls=true localhost:5000). Now you should get a public endpoint (https://xxxxxxxx.ngrok.io) that can be set as a subscriber of an SNS topic.
Issues
Feel free to create an issue if you found a bug or have a feature request.
Metadata
Release files for aws-sns-message-validator 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aws-sns-message-validator-0.0.5.tar.gz | 3.3 kB | Without provenance | Details for aws-sns-message-validator-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aws_sns_message_validator-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for aws_sns_message_validator-0.0.5-py3-none-any.whl |
Total release size: 8.5 kB
Release files / aws-sns-message-validator-0.0.5.tar.gz
| Download URL | aws-sns-message-validator-0.0.5.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55e56e59b8dd9f08400c49c21815fdbb4435f90d289eb6c0c755f6cdbefb5c1d
|
|
BLAKE2b-256 checksum How to use checksums |
337174ae1eec5ed7c272a4a88c9c4aad712c181eabb29927a1dc407d109e46eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.2
|
Release files / aws_sns_message_validator-0.0.5-py3-none-any.whl
| Download URL | aws_sns_message_validator-0.0.5-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
baf0c0344314b4a844ec93f32ffcfe3325f30ceea22560f55f30e7ef790a01b9
|
|
BLAKE2b-256 checksum How to use checksums |
ef5759b18169ecca717b6b8cfdf153676d1c9d56791f6d42eed500836a43d771
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.2
|
Security for aws-sns-message-validator 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.