From f81027ae9f5646ddfa06046836001aaa726c4025 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 23 Jun 2023 12:52:48 +0200 Subject: fix(serde_v8): Do not coerce values in serde_v8 (#19569) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #19568 Values are not coerced to the desired type during deserialisation. This makes serde_v8 stricter. --------- Co-authored-by: Bartek IwaƄczuk --- ext/crypto/00_crypto.js | 2 +- ext/node/polyfills/internal/crypto/diffiehellman.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js index 5189ea181..c75d3b71d 100644 --- a/ext/crypto/00_crypto.js +++ b/ext/crypto/00_crypto.js @@ -4417,7 +4417,7 @@ async function deriveBits(normalizedAlgorithm, baseKey, length) { publicKey: publicKeyData, algorithm: "ECDH", namedCurve: publicKey[_algorithm].namedCurve, - length, + length: length ?? 0, }); // 8. diff --git a/ext/node/polyfills/internal/crypto/diffiehellman.ts b/ext/node/polyfills/internal/crypto/diffiehellman.ts index a5817d59a..3d76deba4 100644 --- a/ext/node/polyfills/internal/crypto/diffiehellman.ts +++ b/ext/node/polyfills/internal/crypto/diffiehellman.ts @@ -189,7 +189,7 @@ export class DiffieHellman { const generator = this.#checkGenerator(); const [privateKey, publicKey] = ops.op_node_dh_generate2( this.#prime, - this.#primeLength, + this.#primeLength ?? 0, generator, ); -- cgit v1.2.3