How safe is the Deno sandbox? Can i execute arbitrary code in a subprocess? #13249
-
I am creating a subprocess like this // create subprocess
const evalPolicy = Deno.run({
cmd: ["deno", "run", "./run.ts", JSON.stringify(input)],
stdout: "piped",
stderr: "piped"
}); and let it execute the arbitrary code in the file run.ts I see that it has access to the global Deno object what sure could extract some parameters like ...
version: { deno: "1.17.0", v8: "9.7.106.15", typescript: "4.5.2" },
build: {
target: "x86_64-unknown-linux-gnu",
arch: "x86_64",
os: "linux",
vendor: "unknown",
env: "gnu"
}
... Is this safe? Thank you and all the best |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Allowing subprocesses with |
Beta Was this translation helpful? Give feedback.
-
Thank you for the quick response! console.log(Deno.run({ cmd: ['touch xd.txt']})); returns PermissionDenied: Requires run access to \"touch xd.txt\", run again with the --allow-run flag\n To clarify: |
Beta Was this translation helpful? Give feedback.
-
It should work using the following //main_program.ts
// deno run --allow-run=deno main_program.ts // Allow run must come before the program name
const process = Deno.run({ cmd: ['deno', 'run', 'your_untrusted_code.ts']}); // Every part of the subcommand must be separated by comma
console.log(await process.status()); |
Beta Was this translation helpful? Give feedback.
Thank you for the quick response!
I dont fully understand it: I tried and found that I cannot execute anything from within my deno subprocess:
returns
To clarify:
I am spawning a deno process without permissions from a deno process with run permissions