-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
crypto: implement rfc7517 recommendation #60221
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
base: main
Are you sure you want to change the base?
crypto: implement rfc7517 recommendation #60221
Conversation
Review requested:
|
print warning with unrelated key combination
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #60221 +/- ##
========================================
Coverage 88.53% 88.54%
========================================
Files 703 704 +1
Lines 207997 208139 +142
Branches 40015 40007 -8
========================================
+ Hits 184150 184287 +137
- Misses 15864 15865 +1
- Partials 7983 7987 +4
🚀 New features to boost your workflow:
|
Is there a test case scenario that fails in any of the browser implementations but works in Node.js related to JWK key_ops? |
I'll add test code. Thanks for your review! |
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.
The reference spec says about the permitted values of key_ops
:
Other values MAY be used.
(...)
Multiple unrelated key operations SHOULD NOT be specified for a key because of the potential vulnerabilities associated with using the same key with multiple algorithms. Thus, the combinations "sign" with "verify", "encrypt" with "decrypt", and "wrapKey" with "unwrapKey" are permitted, but other combinations SHOULD NOT be used.
SHOULD NOT
in this case means:
This phrase, or the phrase "NOT RECOMMENDED" mean that there may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful, but the full implications should be understood and the case carefully weighed before implementing any behavior described with this label.
This makes me wonder if there is a chance that someone may want to allow JWK objects with a set of key_ops
that this PR would consider invalid, in which case we might not want to throw unconditionally.
@tniessen I've asked for a test case that can be checked for in other implementations exactly because I'm uncertain about a rejection being appropriate here. Especially since during import the user specifies the expected keyUsages, and if the user just echoes JWK key_ops as the keyUsages the WebCryptoAPI steps already make it so that only valid usages/ops can be used for a given algorithm. So the question is, really, if the following WebCryptoAPI jwk import clauses
Include rejecting such combinations of key_ops in other implementations. In case it isn't rejected or is inconsistent across implementations I believe the only TODO would be to remove the TODO comment. |
this PR resolves todo comment about RFC7517 section 4.3 recommendation
added print warning with unrelated key combination