From 49c1a8c88112a046c77dc807633dcb715602fb79 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Sun, 9 Aug 2026 22:11:21 +0200 Subject: [PATCH] test: account for [EnforceRange] in test-webcrypto-prototype-pollution Signed-off-by: Filip Skokan --- test/parallel/test-webcrypto-prototype-pollution.mjs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-webcrypto-prototype-pollution.mjs b/test/parallel/test-webcrypto-prototype-pollution.mjs index 8bb93cff0ae5..8ca65ba376f4 100644 --- a/test/parallel/test-webcrypto-prototype-pollution.mjs +++ b/test/parallel/test-webcrypto-prototype-pollution.mjs @@ -265,14 +265,15 @@ await withPoisoned( info: new Uint8Array(0), }, key, length); - // [EnforceRange] and [Clamp] are not set for a plain `unsigned long`, so - // 2 ** 32 wraps to 0 rather than throwing or clamping. + // deriveBits length is [EnforceRange], so 2 ** 32 must throw even when + // conversion option properties are inherited from Object.prototype. for (const attribute of ['enforceRange', 'clamp']) { await withPoisoned( inherited(attribute, true), - common.mustCall(async () => { - assert.strictEqual((await hkdf(2 ** 32)).byteLength, 0); - })); + common.mustCall(() => assert.rejects(hkdf(2 ** 32), { + code: 'ERR_OUT_OF_RANGE', + name: 'TypeError', + }))); } // [AllowResizable] is not set for BufferSource.