Important
Run with deno run --allow-run=deno main.ts
(this allows us to run deno
instead of node
in scripts, but prevents any other nefarious scripts)
npm run start
> [email protected] start
> node evil.js
npm run postinstall
> [email protected] postinstall
> rm -rf ./delete-me
Note
Ideally this would be deno task ...
but that just executes any command. In main.ts I've created a command runner for a given npm script
deno run --allow-run=deno main.ts
node evil.js
┏ ⚠️ Deno requests net access to "api.github.com:443".
┠─ Requested by `fetch()` API.
┠─ To see a stack trace for this prompt, set the DENO_TRACE_PERMISSIONS environmental variable.
┠─ Learn more at: https://docs.deno.com/go/--allow-net
┠─ Run again with --allow-net to bypass this prompt.
┗ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all net permissions) >
rm -rf ./delete-me
┏ ⚠️ Deno requests run access to "rm".
┠─ Requested by `Deno.Command().spawn()` API.
┠─ To see a stack trace for this prompt, set the DENO_TRACE_PERMISSIONS environmental variable.
┠─ Learn more at: https://docs.deno.com/go/--allow-run
┠─ Run again with --allow-run to bypass this prompt.
┗ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all run permissions) >