◐ Shell
clean mode source ↗

lib: harden kKeyOps lookup with null prototype · nodejs/node@25d2e99

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+

}