feat(errors): add SignatureVerificationError - #48
Conversation
Raised for webhook signature mismatches. Stores the received Shade-Signature header and, via the from_mismatch factory, produces a message explaining the likely causes (wrong secret or tampered payload) without ever exposing the expected HMAC value.
📝 WalkthroughWalkthroughA new ChangesSignature verification error
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hello @Tijesunimi004 |
|
All fixed and done @codebestia |
codebestia
left a comment
There was a problem hiding this comment.
LGTM!
Thank you for your contribution.
Summary
Adds
SignatureVerificationError(ShadeError)toerrors.py, closes #34.Shade-Signatureheader value as received (headerattribute).SignatureVerificationError.from_mismatch(header=...)factory builds the error with a message explaining the likely causes (wrong webhook secret or payload modified in transit), mirroring the existingNotFoundError.from_response/InvalidRequestError.from_responsepattern.shadepackage root.This only adds the error type per the issue's proposed steps.
Webhook.construct_event()(issue #66) will raise it once implemented.Test plan
pytest tests/test_errors.py— new tests cover: inherits fromShadeError,headeris optional,from_mismatchstores the header, the message mentions both "secret" and "payload", and the expected signature never appears in the message or as an attribute.pytest) passes: 137 passed.flake8 . --count --select=E9,F63,F7,F82(CI's hard-fail lint check) passes clean.Summary by CodeRabbit
New Features
SignatureVerificationErrorexception for webhook signature/HMAC verification failures.shadepackage.Tests
ShadeError, optional header behavior, mismatch message construction, and ensuring no expected-signature values are exposed.