diff --git a/lib/internal/crypto/util.js b/lib/internal/crypto/util.js index 70e1027946190a..ef0506f3034097 100644 --- a/lib/internal/crypto/util.js +++ b/lib/internal/crypto/util.js @@ -764,6 +764,7 @@ function getDigestSizeInBytes(name) { } const kKeyOps = { + __proto__: null, sign: 1, verify: 2, encrypt: 3, diff --git a/test/parallel/test-webcrypto-util.js b/test/parallel/test-webcrypto-util.js index 89d8575e20ddbd..8e139f4d5a87ec 100644 --- a/test/parallel/test-webcrypto-util.js +++ b/test/parallel/test-webcrypto-util.js @@ -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); + } +}