Skip to content

security: disallow __proto__ / freeze builtins #4324

@kitsonk

Description

@kitsonk

A recent blog post discusses the evils of property access using foo[bar] notation, where bar comes from somewhere else opens up an attack vector to compromise code.

The root of the "evil" though is access __proto__. A co-worker (@camjackson) pointed out to me that Node.js issue discussing it (nodejs/node#31951) and it is of course a lot harder for them and they are considering a flag.

Cam asked me what Deno's stance was. I indicated we hadn't specifically talked about it, but with our security first footing, it seems like something important we should consider. I think we are at the stage where we could just get rid of it. __proto__ is Annex B anyways, and we technically don't have to implement any Annex B to still be compliant with ECMAScript.

Another interesting point, which maybe better overall, is that Node.js supports --frozen-intrinsics and I am almost wondering if we would do that by default, so that built-ins are frozen. I personally don't see a need to even flag it, because while the augmentation of builtins might have been popular in the day, it really runs afoul of good practice. I think it is a bit radical and there really isn't basis in the standard to do it (though I think you would be hard pressed to say that mutability of builtins is specified.

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