Skip to content

Why can Module.prototype.require be deleted? #41095

Description

@Melab

Version

v18.0.0-pre

Platform

No response

Subsystem

No response

What steps will reproduce the bug?

delete require("module").prototype.require

How often does it reproduce? Is there a required condition?

No.

What is the expected behavior?

"Monkey patching" Node's internals is supposed to be impossible.

What do you see instead?

No response

Additional information

Per issue #30697, Node's internals were refactored to make them immune to modification by non-builtin code. So I am wondering why is it that Module.prototype is exposed to external code that can kill Node's module loading mechanism by deleting the property require on it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    moduleIssues and PRs related to the module subsystem.questionIssues that look for answers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions