Deno: support --allow-net=:4500

Created on 24 May 2019  路  4Comments  路  Source: denoland/deno

which should alias to --allow-net=0.0.0.0:4500

Most helpful comment

We should be cautious about expanding something that is explicit already, it erodes the security module. --allow-net=0.0.0.0 binding also to 127.0.0.1 is sort of magical and surprising. I think something that is ambiguous like --allow-net=:4500 or --allow-net=:8000 allowing binding to all the suggested address is fine, but something explicit should stay explicit.

All 4 comments

This will require a bit more work - currently any address passed to allow-net has to match exactly address used in fetch/dial/listen, eg:

// example 1
$ deno --allow-net=localhost --no-prompt run script.ts

// this throws permission denied
await Deno.dial("127.0.0.1:8000"); 
// this throws permission denied as well
await Deno.dial("0.0.0.0:8000"); 
// this one works
await Deno.dial("localhost:8000"); 

// example 2
$ deno --allow-net=127.0.0.1 --no-prompt run script.ts

// script.ts
// this one works
await Deno.dial("127.0.0.1:8000"); 
// this one throws permission denied
await Deno.dial("localhost:8000"); 
// this throws permission denied as well
await Deno.dial("0.0.0.0:8000"); 

// example 3
$ deno --allow-net=0.0.0.0 --no-prompt run script.ts

// script.ts
// this one works
await Deno.dial("0.0.0.0:8000"); 
// this one throws permission denied
await Deno.dial("localhost:8000"); 
// this throws permission denied as well
await Deno.dial("127.0.0.1:8000"); 

Perhaps :8000 could expand to localhost:8000,0.0.0.0:8000,127.0.0.1:8000 ?

Perhaps --allow-net=0.0.0.0 should also allow 127.0.0.1 ?

We should be cautious about expanding something that is explicit already, it erodes the security module. --allow-net=0.0.0.0 binding also to 127.0.0.1 is sort of magical and surprising. I think something that is ambiguous like --allow-net=:4500 or --allow-net=:8000 allowing binding to all the suggested address is fine, but something explicit should stay explicit.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

somombo picture somombo  路  3Comments

justjavac picture justjavac  路  3Comments

ry picture ry  路  3Comments

metakeule picture metakeule  路  3Comments

watilde picture watilde  路  3Comments