-
Notifications
You must be signed in to change notification settings - Fork 1
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
N8N-3776-expressions-xss-part-2 #4
Conversation
src/tmpl.js
Outdated
// var exposedVars = ['Date'] | ||
// expr = 'var window = { ' + exposedVars.map(function(varName) { return varName + ': ' + (typeof window !== 'object' ? 'global' : 'window') + '.' + varName }).join(', ') + ' }; ' + expr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover comments to remove or do they need to be preserved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Forgot about it.
expect(render('{ this.$a }')).to.be(5) | ||
expect(render('{ void 0 }')).to.be(undefined) | ||
// without unprefixed global/window, default convertion to `new (D).Date()` throws here | ||
data.Date = typeof window !== 'object' ? 'global' : 'window' | ||
expect(render('{ new ' + data.Date + '.Date() }')).to.be.a('object') | ||
data.Date = Date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment on L216 is outdated now? If so we should remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is outdated. Removed!
Added window/global variable overwrite in eval context.
We will need to whitelist global variables/constructors that we want to expose in the application using
data
.