Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 25d2e99

Browse filesBrowse files
panvaaduh95
authored andcommitted
lib: harden kKeyOps lookup with null prototype
Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: #62877 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent eeae754 commit 25d2e99
Copy full SHA for 25d2e99

2 files changed

+11Lines changed: 11 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/crypto/util.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/util.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ function getDigestSizeInBytes(name) {
752752
}
753753

754754
const kKeyOps = {
755+
__proto__: null,
755756
sign: 1,
756757
verify: 2,
757758
encrypt: 3,
Collapse file

‎test/parallel/test-webcrypto-util.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-webcrypto-util.js
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const assert = require('assert');
99

1010
const {
1111
normalizeAlgorithm,
12+
validateKeyOps,
1213
} = require('internal/crypto/util');
1314

1415
{
@@ -49,3 +50,12 @@ const {
4950
assert.strictEqual(normalized.name, 'ECDSA');
5051
assert.strictEqual(nameReadCount, 1);
5152
}
53+
54+
{
55+
for (const ops of [
56+
['sign', 'toString', 'constructor'],
57+
['sign', '__proto__', 'constructor'],
58+
]) {
59+
validateKeyOps(ops);
60+
}
61+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.