Skip to content

worker-pool uses new Function() for dynamic compute — RCE footgun #70

Description

@Jaro-c

While reading through src/runtime/server/services/parallel/worker-pool.ts:213 and worker.ts:22 (also apis/parallel-compute.api.ts:187,233) I noticed the worker execution reconstructs code via:

new Function("input", "return (" + functionBody + ")(input)")

in an unsandboxed worker_threads context (eval: true). Today compute is always a dev-authored closure at the call sites in this repo, so it's not reachable from client/network input in shipped code — but nothing stops a consumer from deriving compute from a network payload down the line, and if that happens it's instant RCE in the worker.

I'd suggest forbidding dynamic function bodies and requiring worker tasks to import a named, statically-registered task module instead of stringifying closures.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions