Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Make SNS signature optional #115

Merged
merged 3 commits into from
Sep 30, 2022
Merged

Make SNS signature optional #115

merged 3 commits into from
Sep 30, 2022

Conversation

CumpsD
Copy link
Contributor

@CumpsD CumpsD commented Sep 29, 2022

In my SNS message (being posted on SQS) I dont have the signature fields:

{
    "Records": [
        {
            "attributes": {
                "AWSTraceHeader": "Root=1-633375e5-6992f4381edc004f3f3beed3;Parent=7428100f69529302;Sampled=0",
                "ApproximateFirstReceiveTimestamp": "1664316902967",
                "ApproximateReceiveCount": "1",
                "MessageDeduplicationId": "9",
                "MessageGroupId": "Geert",
                "SenderId": "xxx",
                "SentTimestamp": "1664316902967",
                "SequenceNumber": "18872809200869103616"
            },
            "awsRegion": "eu-central-1",
            "body": "{\n  \"Type\" : \"Notification\",\n  \"MessageId\" : \"f5458878-95d1-5aad-82d9-d3d5edf775d9\",\n  \"SequenceNumber\" : \"10000000000000027000\",\n  \"TopicArn\" : \"arn:aws:sns:eu-central-1:xxx:dev-events.fifo\",\n  \"Message\" : \"{\\\"CustomerDepositedMoney\\\":{\\\"amount\\\":1000.0,\\\"balance\\\":9000.0}}\",\n  \"Timestamp\" : \"2022-09-27T22:15:02.834Z\",\n  \"UnsubscribeURL\" : \"https://sns.eu-central-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-central-1:xxx:dev-events.fifo:aab561d9-73b3-4cdf-b527-9cbfa357eb47\"\n}",
            "eventSource": "aws:sqs",
            "eventSourceARN": "arn:aws:sqs:eu-central-1:xxx:dev-sqs1.fifo",
            "md5OfBody": "4fcc9a1791061d7fc91022734f84850f",
            "messageAttributes": {},
            "messageId": "bd9feb74-23c6-40b7-8b27-8af29b4c140a",
            "receiptHandle": "AQEB8m4uUDMmdKPi0AGmlyV30Eln411zJAi7GTQ0FZdkYOBzDlTwHUdEmXRBqWEa0Re3SwaOvhYx/4kj1DR5mLtJM7adYFj+ovAnUBHljr0gfaQe3WHY0l0vM9RVb/vqUI9weHH5fMCgqYXNanMjoA4KyplNewFvJo/KwxY3cF7LZIpaEZdFREJN5uU1h5u2tQKnCKvMValbToW6JU2LHuArXlo8y9VuS6mIHQVUCDYHn+QCze1JoEWC7EUuiPPaFbT2GjTmCuVr85DpYPH8WyDXvpoaujUWkWoj4rgtVp3AdCA="
        }
    ]
}

Which means my SNS message looks like:

{
  "Type" : "Notification",
  "MessageId" : "f5458878-95d1-5aad-82d9-d3d5edf775d9",
  "SequenceNumber" : "10000000000000027000",
  "TopicArn" : "arn:aws:sns:eu-central-1:xxx:dev-events.fifo",
  "Message" : "{\"CustomerDepositedMoney\":{\"amount\":1000.0,\"balance\":9000.0}}",
  "Timestamp" : "2022-09-27T22:15:02.834Z",
  "UnsubscribeURL" : "https://sns.eu-central-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-central-1:xxx:dev-events.fifo:aab561d9-73b3-4cdf-b527-9cbfa357eb47"
}

This PR makes them optional and confirmed to be working.

@calavera
Copy link
Owner

thanks for making these changes, can you add a test with your example payload?

@CumpsD
Copy link
Contributor Author

CumpsD commented Sep 30, 2022

@calavera sure, just not sure where I should place the fixture? it looks like they are all in generated but the README says to not touch that folder

@CumpsD
Copy link
Contributor Author

CumpsD commented Sep 30, 2022

test sns::test::my_example_sns_obj_unsigned_event ... ok

Done :)

Copy link
Owner

@calavera calavera left a comment

Choose a reason for hiding this comment

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

perfect, thanks!

@calavera
Copy link
Owner

it looks like they are all in generated but the README says to not touch that folder

Yeah, it's a little unfortunate. #62

@calavera calavera merged commit 922639e into calavera:master Sep 30, 2022
@CumpsD
Copy link
Contributor Author

CumpsD commented Sep 30, 2022

Thanks 👍🏻

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants