node icon indicating copy to clipboard operation
node copied to clipboard

isDeepStrictEqual does not validate skipPrototype argument

Open outslept opened this issue 1 week ago • 1 comments

Version

v26.13.0

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

util

What steps will reproduce the bug?

node -p "require('util').isDeepStrictEqual({}, Object.create(null), { skipPrototype: false })"

How often does it reproduce? Is there a required condition?

always

What is the expected behavior? Why is that the expected behavior?

it should validate the third argument and throw when a non-boolean value is passed.

What do you see instead?

true is returned

Additional information

No response

outslept avatar Nov 27 '26 13:11 outslept

Hi,

I reproduced this issue locally on Node.js v24.15.0 (macOS) and confirmed that skipPrototype is currently evaluated based on truthiness rather than validated as a boolean.

I also ran the existing tests, which passed, and noticed that they explicitly accept null and undefined:

https://github.com/nodejs/node/blob/main/test/parallel/test-util-isDeepStrictEqual.js#L153-L155

Before introducing validation, should we preserve the existing behavior for null and undefined, or should rejecting null be considered a semver-major change?

I'd be happy to work on the fix and add regression tests once the expected behavior is clarified.

Thanks!

Udit-Agarwal20 avatar Nov 27 '26 14:11 Udit-Agarwal20