-
Notifications
You must be signed in to change notification settings - Fork 431
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
Harden against prototype pollution. #275
base: master
Are you sure you want to change the base?
Conversation
Well, I typoed this, but it does fix the pollution. Will fix. |
Hi @sayrer, What do you think about that solution? var context = Object.create(null, {
code: {
value: "",
writable: true,
enumerable: true,
configurable: true
},
subs: {
value: Object.create(null),
writable: true,
enumerable: true,
configurable: true
},
partials: {
value: Object.create(null),
writable: true,
enumerable: true,
configurable: true
}
}); |
It doesn't quite work, but that is another way.
|
It looks like I'll have to fix the test harness before I check this in, and your way will still break anyone relying on the prototype chain (probably unintentionally). But I'll see which one is cleaner in the end. |
Also, another simple way - predefined empty prefix var context = { code: '', subs: {}, partials: {}, prefix: '' }; |
This makes it more difficult for RCEs in other libraries to overwrite the prototype chain to manipulate Hogan, but also prevents authors from manipulating the prototype chain on purpose. I think the latter is rare enough that this change is worth it.
This first patch just fixes
node.indent
. See #274.