mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
lib: harden kKeyOps lookup with null prototype
Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: https://github.com/nodejs/node/pull/62877 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
1 parent
800f5828dc
commit
1f6f3ac871
2 files changed
+11
No files matched your search
@@ -764,6 +764,7 @@ function getDigestSizeInBytes(name) {
|
||||
}
|
||||
|
||||
const kKeyOps = {
|
||||
__proto__: null,
|
||||
sign: 1,
|
||||
verify: 2,
|
||||
encrypt: 3,
|
||||
|
||||
@@ -9,6 +9,7 @@ const assert = require('assert');
|
||||
|
||||
const {
|
||||
normalizeAlgorithm,
|
||||
validateKeyOps,
|
||||
} = require('internal/crypto/util');
|
||||
|
||||
{
|
||||
@@ -49,3 +50,12 @@ const {
|
||||
assert.strictEqual(normalized.name, 'ECDSA');
|
||||
assert.strictEqual(nameReadCount, 1);
|
||||
}
|
||||
|
||||
{
|
||||
for (const ops of [
|
||||
['sign', 'toString', 'constructor'],
|
||||
['sign', '__proto__', 'constructor'],
|
||||
]) {
|
||||
validateKeyOps(ops);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user