-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistency of prototype chain lookup for parameters #43401
Comments
I think only the only use case that has been considered is |
Dug up a bit: this problem was found, discussed and added to
tsc-agenda
However, I couldn't find a further сontinuation in terms of resolving or documenting it. /cc @BridgeAR Looks like the main argument for prototype lookups is that it is consistent with the ECMAScript specs and therefore with how things in JS usually work; and the main argument against it is that in Node.js core it is actively prevented to guard against prototype pollution. Personally I don't think that a strict and urgent goal of having consistent behaviour across all currently existing APIs is worth the effort, churn and potential breakage. Assuming that, two questions remain open:
|
@LiviaMedeiros thanks for reminding me. |
Version
v19.0.0-pre
Platform
any
Subsystem
lib
What steps will reproduce the bug?
run()
tries to create nested directories, then remove them, then access topmost one.{}
,mkdir
must fail withENOENT
because it's not recursive.{ recursive: true }
,stat
must fail withENOENT
because directory was deleted.Depending on if we care that each property is "own",
Object.create(defaultDirOptions)
should behave either as (1) or as (2).However, currently
rm
fails withEISDIR
. So,mkdir
is recursive butrm
is not.How often does it reproduce? Is there a required condition?
It depends on methods, it depends on version (pretty sure that some of these are changed within
semver-patch
level).For some methods is might even depend on which property we access or on something even less related.
What is the expected behavior?
Consistency.
Or a warning somewhere, that only ownProperties are guaranteed to work.
Or an explicit agreement that it's UB "by design".
What do you see instead?
Inconsistency.
Additional information
In most cases, inherited properties are dropped by copying (e.g.
{ ...options }
).The text was updated successfully, but these errors were encountered: