Skip to content

Add support for "--disallow-code-generation-from-strings" flag to workers #60371

@capricorn86

Description

@capricorn86

What is the problem this feature will solve?

I'm the creator and main maintainer of happy-dom. We recommend users to use the flags --disallow-code-generation-from-strings and --frozen-intrinsics when Javascript evaluation is enabled in happy-dom to make it harder for a potential attacker to escape a VM context and execute code at process level.

One of the packages uses Workers and it would be great if these flags could be sent in to "execArgv" when creating the Worker. It seems like --frozen-intrinsics is already supported.

What is the feature you are proposing to solve the problem?

Add support for --disallow-code-generation-from-strings to "execArgv" in Worker.

Example:

const worker = new Worker(new URL('ServerRendererWorker.js', import.meta.url), {
   execArgv: ['--disallow-code-generation-from-strings']
});

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.workerIssues and PRs related to Worker support.

    Type

    No type

    Projects

    Status

    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions