profile
viewpoint

Ask questions--allow-net=:8080 broken

If any code uses shorthand notation:

import { serve } from "https://deno.land/std/http/server.ts"
const PORT = 8080
serve(`:${PORT}`)

then any variant of

deno run --allow-net=:8080 server.ts
deno run --allow-net=localhost:8080 server.ts
deno run --allow-net=0.0.0.0:8080 server.ts
deno run --allow-net=127.0.0.1:8080 server.ts

fails.

Unfortunately, a lot of libraries in x use this pattern which makes locking down permissions impossible without forking all those libraries.

denoland/deno

Answer questions jsouto18

I've tested this on the latest release and I've managed to execute the code successfully running deno run --allow-net=:8080 server.ts or deno run --allow-net=0.0.0.0:8080 server.ts which seems to be the intended behaviour as the serve function binds to 0.0.0.0:8080. @ry is this the intended behaviour? The only other thing I found odd was trying to run serve(127.0.0.1:8080) and running deno run --allow-net=localhost:8080 server.ts fails because localhost is not resolved to the configured IP, for example in /etc/hosts.

useful!

Related questions

{WSL 2} Permission denied (os error 13) hot 1
gRPC in Deno? hot 1
deno remove/uninstall subcommand hot 1
Insight required: Resource (TCP) errors hot 1
TCP accept loop doesn't use for-await hot 1
Support d.ts files hot 1
Restore runtime lib generation capability hot 1
disable flaky tests _048_media_types_jsx and _019_media_types hot 1
Typescript Custom Transformers Support hot 1
reorg directory structure hot 1
Centos 7 GLIBC_2.18 not found hot 1
"deno ast script.ts" hot 1
Text decoding performance abysmally slow. hot 1
"deno ast script.ts" hot 1
Can't build master hot 1
source:https://uonfu.com/
Github User Rank List