-
Notifications
You must be signed in to change notification settings - Fork 30
feat: enforce strict crypto header checks #734
Conversation
e2e4010
to
3eb6df9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far.
+1 |
b2ef3fc
to
3845d5a
Compare
c9ada09
to
adb4562
Compare
Current coverage is 100% (diff: 100%)@@ master #734 diff @@
====================================
Files 47 46 -1
Lines 9065 9156 +91
Methods 0 0
Messages 0 0
Branches 0 0
====================================
+ Hits 9065 9156 +91
Misses 0 0
Partials 0 0
|
adb4562
to
9137ad6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
R+
required=False, | ||
load_from="encryption-key", | ||
missing=None, | ||
validate=lambda x: x is None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of validation error message does this produce (if an encryption-key's included)? If it's not very clear we might want to raise a specific InvalidRequest with a more helpful message.
Here's marshmallow's example for rejecting specific fields:
http://marshmallow.readthedocs.io/en/latest/extending.html#validating-original-input-data
with assert_raises(InvalidRequest) as cm: | ||
schema.load(data) | ||
|
||
eq_(cm.exception.message, "Unknown Content-Encoding") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might as well check for the expected errno and maybe status_code here additionally
Explicitly verify the crypto headers are present and match either the 01 or 04 webpush encryption drafts. This also includes a refactor of the push schemas to remove the push_validation file. Closes #188
9137ad6
to
5a986d0
Compare
errno=110) | ||
|
||
@validates_schema(pass_original=True) | ||
def check_unknown_fields(self, data, original_data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah one more thing, let's clarify this method name. 'reject_encryption_key' would work
Explicitly verify the crypto headers are present and match either the 01 or 04 webpush encryption drafts. This also includes a refactor of the push schemas to remove the push_validation file. Closes #188
* feat: enforce strict crypto header checks Explicitly verify the crypto headers are present and match either the 01 or 04 webpush encryption drafts. This also includes a refactor of the push schemas to remove the push_validation file. Closes #188
Explicitly verify the crypto headers are present and match either the
01 or 04 webpush encryption drafts. This also includes a refactor of
the push schemas to remove the push_validation file.
Closes #188