mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
test: account for [EnforceRange] in test-webcrypto-prototype-pollution
Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65173 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit is contained in:
1 parent
6a142c03e9
commit
219495fe2c
1 file changed
+6
-5
@@ -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 () => {
|
||||
await assert.rejects(hkdf(2 ** 32), { code: 'ERR_OUT_OF_RANGE' });
|
||||
}));
|
||||
common.mustCall(() => assert.rejects(hkdf(2 ** 32), {
|
||||
code: 'ERR_OUT_OF_RANGE',
|
||||
name: 'TypeError',
|
||||
})));
|
||||
}
|
||||
|
||||
// [AllowResizable] is not set for BufferSource.
|
||||
|
||||
Reference in new issue
Block a user