Warning message when there is an attempt to overwrite __proto__ #10222
Labels
deno_core
Changes in "deno_core" crate are needed
suggestion
suggestions for new features (yet to be agreed)
@kitsonk In this comment you mentioned that you'd prefer not to throw an error when
__proto__
is overwritten likefoo.__proto__=bar
(as opposed tosetPrototypeOf
). I wonder what you (and other Deno devs) think about throwing a one-off warning message instead?I'm porting a tangle of browser code across (the node XMLHttpRequest polyfill using browserify, so that I can get Pyodide running in Deno) and just fixed a somewhat "silent" bug that was caused by this. Luckily I'd just created #10221 for curiosity's sake, so it was quicker to track down, but it still took me an hour because I didn't realise that there was another attempted
__proto__
edit in the codebase. I imagine that some others won't have as easy a time, because it's definitly not obvious that__proto__
would be frozen in Deno, while being editable in browsers.I think an error would actually make some sense - better to crash the server (and thus alert the admin) than have silent bugs lurking. But a
console.warn
would be a good middle ground perhaps.Cheers!
The text was updated successfully, but these errors were encountered: