Open Cherry opened 8 months ago
There are a couple different approaches we could take here to make this experience better, from ignoring keys named __proto__
to erroring if an invalid key is present.
What behaviour would you expect from Wrangler in this case?
I think ignoring keys like __proto__
is the most common mitigation to this, along with Object.create(null)
in places over {}
.
Which Cloudflare product(s) does this pertain to?
Wrangler core
What version(s) of the tool(s) are you using?
3.29.0
What version of Node are you using?
20.11.1
What operating system and version are you using?
Windows
Describe the Bug
Observed behavior
By using the
__proto__
key in certain conditions, you can crash the wrangler process. A smarter actor than myself may be able to exploit this for deeper prototype pollution.Steps to reproduce
wrangler.toml
:[vars] proto = {evil = true}
(etc);.
src/index.ts
:npx wrangler dev
Or full stack trace (observed when editing the
wrangler.toml
of a previously functional worker: