FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test: account for [EnforceRange] in test-webcrypto-prototype-pollution · nodejs/node@219495f · GitHub

/ node Public

Commit 219495f

Browse files
authored andcommitted
test: account for [EnforceRange] in test-webcrypto-prototype-pollution
Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: #65173 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
1 parent 6a142c0 commit 219495f

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎test/parallel/test-webcrypto-prototype-pollution.mjs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,15 @@ await withPoisoned(
265265
info: new Uint8Array(0),
266266
}, key, length);
267267

268-
// [EnforceRange] and [Clamp] are not set for a plain `unsigned long`, so
269-
// 2 ** 32 wraps to 0 rather than throwing or clamping.
268+
// deriveBits length is [EnforceRange], so 2 ** 32 must throw even when
269+
// conversion option properties are inherited from Object.prototype.
270270
for (const attribute of ['enforceRange', 'clamp']) {
271271
await withPoisoned(
272272
inherited(attribute, true),
273-
common.mustCall(async () => {
274-
await assert.rejects(hkdf(2 ** 32), { code: 'ERR_OUT_OF_RANGE' });
275-
}));
273+
common.mustCall(() => assert.rejects(hkdf(2 ** 32), {
274+
code: 'ERR_OUT_OF_RANGE',
275+
name: 'TypeError',
276+
})));
276277
}
277278

278279
// [AllowResizable] is not set for BufferSource.

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL