Run javascript sandboxed
I know that workers have their eval command disabled, but is there a way to use a cloudflare worker as a way to execute javascript in a sandboxed environment?
For example, I send a payload to my worker containing some javascript code, and the worker executes the javascript safely and returns the result
6 Replies
There is no way to do this except to run a (very hacky, likely quite slow, and feature-limited) WASM JS runtime like QuickJS. The closest you'll get to dynamically running code is Workers for Platforms (Workers that can be quickly deployed and executed via an API).
I see. Is it safe to assume that Workers for Platforms is a paid feature?
Correct, yeah.
Cloudflare Docs
Workers for Platforms · Cloudflare for Platforms docs
Workers for Platforms allows you to run your own code as a wrapper around your user's code. With Workers for Platforms, you can logically group your code separately from your users' code, create custom logic, and use additional APIs such as script tags for bulk operations.
Well thanks for the response. Does this server have a command to mark threads as solved?
Not a command but I'll do that now.