denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.89k stars 5.39k forks source link

Panic when passing wildcard to allow-net #23552

Open iMarv opened 6 months ago

iMarv commented 6 months ago

Platform: linux x86_64 Version: 1.42.1 Args: ["deno", "run", "--allow-read", "--allow-write=notion-next", "--allow-net=api.notion.com,*.amazonaws.com", "--allow-env", "main.ts"]

thread 'main' panicked at runtime/permissions/lib.rs:741:22: called Result::unwrap() on an Err value: InvalidLabelChar

yazan-nidal commented 6 months ago

Please provide a reproducible example and more info

iMarv commented 6 months ago

That in itself should be reproducible with an empty main.ts, as it seems to be a bug with parsing in the cli itself.

yazan-nidal commented 6 months ago

Hi @mmastrac @iMarv, I checked the issue and , it was fixed by this PR https://github.com/denoland/deno/pull/23590 so can u please review it?

yazan-nidal commented 6 months ago

@iMarv @mmastrac

what the expected outcome?

iMarv commented 6 months ago

It should not panic I guess.

I am not a maintainer, but I would figure that it shall throw some error that wildcards are not allowed.

lucacasonato commented 4 months ago

This now does not panic anymore

joscha commented 3 months ago

I can still see this panicking

Task test:single deno test --allow-env=API_KEY,NODE_EXTRA_CA_CERTS '--allow-net=api.affinity.co,*.amazonaws.com:443' --doc --allow-read=./src/v1/tests/ "src/v1/tests/entity_files_test.ts"

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos aarch64
Version: 1.45.2
Args: ["/nix/store/xiz264k79b2419vp0b82v15k552whcgp-deno-1.45.2/bin/deno", "test", "--allow-env=API_KEY,NODE_EXTRA_CA_CERTS", "--allow-net=api.affinity.co,*.amazonaws.com:443", "--doc", "--allow-read=./src/v1/tests/", "src/v1/tests/entity_files_test.ts"]

thread 'main' panicked at cli/args/flags.rs:4628:60:
called `Result::unwrap()` on an `Err` value: ErrorInner { kind: InvalidValue, context: FlatMap { keys: [], values: [] }, message: Some(Raw("invalid host: '*.amazonaws.com'\n\nCaused by:\n    invalid char found in FQDN")), source: None, help_flag: None, styles: Styles { header: Style { fg: None, bg: None, underline: None, effects: Effects() }, error: Style { fg: None, bg: None, underline: None, effects: Effects() }, usage: Style { fg: None, bg: None, underline: None, effects: Effects() }, literal: Style { fg: None, bg: None, underline: None, effects: Effects() }, placeholder: Style { fg: None, bg: None, underline: None, effects: Effects() }, valid: Style { fg: None, bg: None, underline: None, effects: Effects() }, invalid: Style { fg: None, bg: None, underline: None, effects: Effects() } }, color_when: Never, color_help_when: Never, backtrace: None }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I can't see this issue mentioned on https://github.com/denoland/deno/releases anywhere, so I am not sure if it's fixed somewhere upstream from 1.45.2?

joscha commented 3 months ago

24397 is closed against 1.45.0 which means in 1.45.2 (see above) it shouldn't panic anymore?

bartlomieju commented 3 months ago

I can confirm that it still panics on latest Deno

yazan-abdalrahman commented 3 months ago

I can confirm that it still panics on latest Deno @bartlomieju

image

I will work on it, okay?

yazan-abdalrahman commented 3 weeks ago

It was fixed in the last release,

PS D:\yad\deno> .\target\debug\deno run  --allow-net=www.google.*om .\main.js
error: invalid host: 'www.google.*om'

Caused by:
    invalid char found in FQDN
PS D:\yad\deno> .\target\debug\deno -v                                       
deno 2.0.1
PS D:\yad\deno>