Skip to content
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

Merged
merged 3 commits into from
Jun 8, 2022
Merged

Conversation

alexgrozav
Copy link
Member

@alexgrozav alexgrozav commented Jun 1, 2022

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.

@alexgrozav alexgrozav requested review from janober and ivov June 1, 2022 14:53
src/tmpl.js Outdated
Comment on lines 155 to 156
// var exposedVars = ['Date']
// expr = 'var window = { ' + exposedVars.map(function(varName) { return varName + ': ' + (typeof window !== 'object' ? 'global' : 'window') + '.' + varName }).join(', ') + ' }; ' + expr
Copy link
Collaborator

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?

Copy link
Member Author

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.

@alexgrozav alexgrozav requested a review from ivov June 2, 2022 08:13
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
Copy link
Collaborator

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is outdated. Removed!

@ivov ivov merged commit 37cbae9 into master Jun 8, 2022
@alexgrozav alexgrozav deleted the n8n-3776-expressions-xss-part-2 branch June 8, 2022 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants