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

Securize: Increase isolation by stripping away prototypes #350

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dmsnell
Copy link

@dmsnell dmsnell commented Sep 25, 2019

Status: DO NOT MERGE

See #247
See #339

When we assign our new (secured-eval) we've been allowing the window
property to bleed through as this. Additionally we have been setting
our forbidden symbols as the empty object {} which also exposes the
Object prototype.

In this patch we're replacing both of those in an attempt to further
limit the extent to which scripts can access global data.

The downside to this approach is that we've lost all prototypes that we
want, such as Array.prototype.map. The severity of this limitation is
so high that it's probably unmergable, but I'm hoping there might still
be a way to resolve that.

When we assign our new `(secured-eval)` we've been allowing the `window`
property to bleed through as `this`. Additionally we have been setting
our forbidden symbols as the empty object `{}` which also exposes the
`Object` prototype.

In this patch we're replacing both of those in an attempt to further
limit the extent to which scripts can access global data.

The downside to this approach is that we've lost all prototypes that we
want, such as `Array.prototype.map`. The severity of this limitation is
so high that it's probably unmergable, but I'm hoping there might still
be a way to resolve that.
(set! eval-in-global-scope js/eval)
(j/assoc! js/window :klipse_unsecured_eval original-eval)
(j/assoc! js/window :klipse_eval_sandbox (clj->js (zipmap the-forbidden-symbols (repeat {}))))
(j/assoc! js/window :klipse_eval_sandbox (clj->js (zipmap the-forbidden-symbols (repeat (js/Object.create nil)))))
Copy link
Author

Choose a reason for hiding this comment

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

@viebel I think this one makes sense on its own as a change; I'm not entirely sure of the security implications though it does unhinge the forbidden symbols from the Object and Function prototypes…

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.

1 participant