Skip to content

MPP-3852: Test verify_from_sns #5234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 3, 2024
Merged

Conversation

jwhitlock
Copy link
Member

This PR adds tests for verify_from_sns, which verifies the signature in an SNS JSON body against the signing certificate. Previously, this code was untested, and mocked whenever called. This hides that OpenSSL.crypto.verify has been removed in 24.3.0 (see #5228). When running the tests, pytest will now report:

DeprecationWarning: verify() is deprecated. Use the equivalent APIs in cryptography.

My plan is to rebase PR #5228 after this merges, and we should then see test failures. I'll then replace pyopenssl and pem with the cryptography equivalents. The change will be the exception raised when verification fails.

@jwhitlock jwhitlock requested a review from groovecoder December 2, 2024 18:28
@jwhitlock
Copy link
Member Author

Here's the warning in CircleCI (build_test_backend):

=============================== warnings summary ===============================
emails/tests/sns_tests.py::test_verify_from_sns_notification_with_subject_ver1
emails/tests/sns_tests.py::test_verify_from_sns_notification_with_subject_ver1_fails
emails/tests/sns_tests.py::test_verify_from_sns_notification_without_subject_ver1
emails/tests/sns_tests.py::test_verify_from_sns_subscription_ver1
  /app/emails/sns.py:83: DeprecationWarning: verify() is deprecated. Use the equivalent APIs in cryptography.
    crypto.verify(

Copy link
Member

@groovecoder groovecoder left a comment

Choose a reason for hiding this comment

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

praise: very nice tests!

@groovecoder groovecoder added this pull request to the merge queue Dec 3, 2024
Merged via the queue into main with commit 31beac9 Dec 3, 2024
32 checks passed
@groovecoder groovecoder deleted the test-verify-from-sns-mpp-3852 branch December 3, 2024 20:34
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