Repository navigation
Web Crypto API test and key import issues #47864
Copy link
Copy link
Closed
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.testIssues and PRs related to Node.js core tests and test infrastructure.Issues and PRs related to Node.js core tests and test infrastructure.webcryptoIssues and PRs related to the Web Crypto API.Issues and PRs related to the Web Crypto API.
Description
Version
v20.1.0
Platform
No response
Subsystem
crypto.webcrypto
What steps will reproduce the bug?
No response
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior? Why is that the expected behavior?
No response
What do you see instead?
While looking at Node's crypto API, I found some potential issues in the Web Crypto tests:
- In the Wrap-Unwrap tests, the mapping returns the tests instead of adding them to the variations list, this causes the tests in this file to not actually run.
return testWrapping(name, keys); - Here we import a private EdDsa key with empty usages. Based on the Web Crypto spec this is not allowed, when importing a private key the usages must not be empty. This also indicates a bug in the implementation as the test cases require non-conforming behavior. Based on a brief search of the code, the test-webcrypto-sign-verify-ecdsa.js and test-webcrypto-sign-verify-rsa.js tests may also be affected.
subtle.importKey( - Less important, but this should be privateUsages.
publicUsages),
Additional information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.testIssues and PRs related to Node.js core tests and test infrastructure.Issues and PRs related to Node.js core tests and test infrastructure.webcryptoIssues and PRs related to the Web Crypto API.Issues and PRs related to the Web Crypto API.
Activity
tniessen commentedon May 5, 2023
cc @panva
panva commentedon May 5, 2023
I'll have a look later today.
test: fix webcrypto wrap unwrap tests
crypto: fix webcrypto private/secret import with empty usages
test: use appropriate usages for a negative import test
panva commentedon May 6, 2023
Thank you @fhanau, I've opened individual PRs to address each point.
fhanau commentedon May 6, 2023
You're welcome, thanks for the quick response!
test: fix webcrypto wrap unwrap tests
crypto: fix webcrypto private/secret import with empty usages
test: use appropriate usages for a negative import test
panva commentedon May 7, 2023
All PRs landed.
test,crypto: update WebCryptoAPI WPT
test: fix webcrypto wrap unwrap tests
crypto: fix webcrypto private/secret import with empty usages
test: use appropriate usages for a negative import test
test,crypto: update WebCryptoAPI WPT
crypto: fix webcrypto private/secret import with empty usages
test: fix webcrypto wrap unwrap tests
crypto: fix webcrypto private/secret import with empty usages
test: use appropriate usages for a negative import test
test,crypto: update WebCryptoAPI WPT
test: fix webcrypto wrap unwrap tests
crypto: fix webcrypto private/secret import with empty usages
test: use appropriate usages for a negative import test
test,crypto: update WebCryptoAPI WPT