{"id":26758,"library":"aws-sns-message-validator","title":"AWS SNS Message Validator","description":"A Python library for validating AWS SNS messages, including signature verification using AWS's public certificates. Version 0.0.5, last updated in 2020. Low release cadence.","status":"active","version":"0.0.5","language":"python","source_language":"en","source_url":"https://github.com/wlwg/aws-sns-message-validator","tags":["aws","sns","validator","message","verification"],"install":[{"cmd":"pip install aws-sns-message-validator","lang":"bash","label":"pip"}],"dependencies":[{"reason":"Required for certificate and signature handling","package":"cryptography","optional":false},{"reason":"Used to download AWS certificates","package":"requests","optional":false}],"imports":[{"note":"Correct import path as per package.","symbol":"SNSMessageValidator","correct":"from aws_sns_message_validator import SNSMessageValidator"}],"quickstart":{"code":"import json\nfrom aws_sns_message_validator import SNSMessageValidator\n\nvalidator = SNSMessageValidator()\nmessage = {\n    'Type': 'Notification',\n    'MessageId': '...',\n    'TopicArn': '...',\n    'Subject': '...',\n    'Message': '...',\n    'Timestamp': '...',\n    'SignatureVersion': '1',\n    'Signature': '...',\n    'SigningCertURL': '...',\n    'UnsubscribeURL': '...'\n}\nresult = validator.validate_message(json.dumps(message))\nprint(result)","lang":"python","description":"Validate an AWS SNS message by passing the full JSON message string."},"warnings":[{"fix":"Always json.dumps() your dict before calling validate_message.","message":"The validate_message method expects a JSON string, not a dict. Passing a dict will cause a TypeError.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure the SigningCertURL is always an AWS https URL (e.g., https://sns.us-east-1.amazonaws.com/...).","message":"Certificate URL must be HTTPS and point to a valid AWS certificate. The library does not validate the URL beyond downloading it.","severity":"gotcha","affected_versions":"all"},{"fix":"Ignore warnings or use a different library like 'aws-encryption-sdk' for strict compliance.","message":"The library uses md5 which is deprecated; some Python environments may raise warnings.","severity":"deprecated","affected_versions":"0.0.5"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use json.dumps(message) before calling validator.validate_message().","cause":"Passing a dict directly to validate_message instead of a JSON string.","error":"TypeError: the JSON object must be str, bytes or bytearray, not 'dict'"},{"fix":"Use: from aws_sns_message_validator import SNSMessageValidator","cause":"Incorrect import path (e.g., from aws_sns_message_validator import SNSMessageValidator not just import aws_sns_message_validator).","error":"AttributeError: module 'aws_sns_message_validator' has no attribute 'SNSMessageValidator'"},{"fix":"Ensure SigningCertURL is a valid HTTPS URL to an AWS SNS endpoint. Add proxies or override network settings if behind a firewall.","cause":"The certificate URL is unreachable, possibly because of network restrictions or a non-AWS URL.","error":"requests.exceptions.ConnectionError: HTTPSConnectionPool(host='sns.us-east-1.amazonaws.com', port=443): Max retries exceeded"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}