Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

How do I expose "safe" functions to the sandbox #3

Open
InDieTasten opened this issue Mar 29, 2017 · 0 comments
Open

How do I expose "safe" functions to the sandbox #3

InDieTasten opened this issue Mar 29, 2017 · 0 comments

Comments

@InDieTasten
Copy link

InDieTasten commented Mar 29, 2017

I'm trying to provide a write function to my sandbox.

The write command in itself is pretty complex and written in TypeScript, so I won't post it.

The sandboxed code looks like this:

var code = compiler('(function () { try { \
\
    write("Hello World!\\n>"); \
\
} catch(err) { log(err) } })()');

and I run it like this:

    code({
        write: function(msg: string) {
            terminalObj.write(msg);
        },
        log: function(msg: any) {
            console.info(msg);
        }
    });

Now what happens is that within my terminalObj.write is e.g. a slice on an array of numbers that is a property of my terminalObj. Right at the slice (I've narrowed it down to just the slice) the sandbox kicks in and claims: "Error: You cannot set properties on a sandboxed object"


Here is a screenshot I took from apply right before the set function will throw the top exception with the error message above:
image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant