Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Locking Javascript objects

0
0
Hello!

In general we don't recommend passing script objects from one engine to another, even if those engines are in the same V8 runtime. ClearScript has some support for this, and even some unit tests, but it doesn't leverage V8's one-shared-heap-per-runtime architecture. That is, an engine may hold a foreign script object, but its access to that object will always be proxied through the managed ClearScript layer, and that involves a lot of overhead. Note that this doesn't apply to host objects, which you can expose in multiple engines without additional overhead.

As for securing your script platform against untrusted scripts, there are things you can do, especially if you're using V8. Some suggestions:
  1. Instead of executing untrusted scripts directly within the global context, consider wrapping them within anonymous functions that internally enable strict mode.
  2. Use Object.defineProperty() and Object.freeze() to harden your service objects.
Cheers!

Viewing all articles
Browse latest Browse all 2297