organizerconnect / django-bouncy

A Django package used to process bounce and abuse reports from AWS Simple Email Service
Other
8 stars 14 forks source link

Signature verification failing in French - "('rsa routines', 'int_rsa_verify', 'bad signature')" #9

Open otjonathanh opened 4 years ago

otjonathanh commented 4 years ago

I am currently running django-bouncy 0.2.8, and am having problems specifically when an email bounces in French.

Verification succeeds in English without issues, and the rest of my codebase further processes the new Bounce record properly. However when the initial email is sent in French, the bounce fails. Currently the message from django-bouncy is just "Verification failed %s".

I've contacted AWS support, and they confirmed that their SNS subscription does not have its message content altered in any way based on language settings. They suggested I come here to raise an issue. I've also pulled in 0.2.8 source as an installed app in my Django backend in order to add extra logging to debug via Sentry, and I get the following error: [('rsa routines', 'int_rsa_verify', 'bad signature')]. This happens in the except clause when trying crypto.verify() within the utils.verify_notification function.

From what I can see in Sentry, the certificate retrieved is identical in both languages, so I suspect somehow data isn't being escaped properly in French and the hashes aren't matching up.

Do you have any insight as to what might be causing this?

andypapas commented 3 years ago

This seems to fix the problem for me: https://github.com/thenewguy/django-bouncy/commit/7fa4da7ddfeb98795b9fd40866bce56606d49525