Skip to content

Sandbox escape possibility (this) #14

@ghost

Description

With the default setup it is easily possible to escape the sandbox:

const compiler = require('@nx-js/compiler-util')
compiler.compileCode('return this')({})
// returns Object [global]

There is a way to protect against this vulnerability:

compiler.compileCode('return this').bind({})({})
// returns {}

But this library should be "secure by default".

Occurs in both nodejs and browser.
Version: 2.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions