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

Make options.bindingGlobals empty by default #165

Merged
merged 4 commits into from
Feb 15, 2022

Conversation

danieldickison
Copy link
Collaborator

This should make the default build safer by preventing access to things like document and fetch. For backwards compatibility, I think we need to keep window the bindingGlobals for the knockout build.

@brianmhunt brianmhunt self-requested a review February 15, 2022 19:22
Copy link
Member

@brianmhunt brianmhunt left a comment

Choose a reason for hiding this comment

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

👍

@@ -22,7 +22,7 @@ var options = {
allowVirtualElements: true,

// Global variables that can be accessed from bindings.
bindingGlobals: _global,
bindingGlobals: {},
Copy link
Member

Choose a reason for hiding this comment

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

This should be Object.create(null) so there's no Object prototype chain to pollute. [1]

[1] https://stackoverflow.com/a/15518712/19212

@brianmhunt brianmhunt merged commit 8b86273 into knockout:main Feb 15, 2022
@danieldickison danieldickison deleted the empty-bindingGlobals branch February 15, 2022 19:39
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