Skip to content

Allow wildcards in --allow-net allow lists. #6532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
erisanolasheni opened this issue Jun 27, 2020 · 11 comments · May be fixed by #29327
Open

Allow wildcards in --allow-net allow lists. #6532

erisanolasheni opened this issue Jun 27, 2020 · 11 comments · May be fixed by #29327
Assignees
Labels
cli related to cli/ dir suggestion suggestions for new features (yet to be agreed)

Comments

@erisanolasheni
Copy link

erisanolasheni commented Jun 27, 2020

It will be good to allow wildcards in the --allow-net allow lists.

For example, this code throws errors:

//Import the server module
await fetch('https://facebook.com')

deno run --allow-net=facebook.com server.js

Because https://facebook.com redirects to https://www.facebook.com

This should be possible to run it;
deno run --allow-net=*.facebook.com server.js

Port based wildcards might also be good. For example
https only
deno run --allow-net=https://* server.js
or
deno run --allow-net=*/**:443 server.js

@Spoonbender
Copy link
Contributor

Just to clarify a nuance here:
IMO --allow-net=https://* server.js should not be equivalent to --allow-net=*/**:443 server.js:
The first one is scheme based (protocol-based), and should allow me to access everything using HTTPS, even if the server-side port is not 443 (i.e. https://somewhere.com:1234 should work).
The second one is port-based, and should allow me to access everything on port 443, even via non-HTTPS protocols such as HTTP, AMQP, MQTT etc. (i.e. amqp://somwhere:443 should work).

@erisanolasheni
Copy link
Author

Yes you are right.

@bartlomieju bartlomieju added cli related to cli/ dir suggestion suggestions for new features (yet to be agreed) labels Nov 18, 2020
@mbrevoort
Copy link

This especially! --allow-net=*.slack.com 🙏

@Grunet
Copy link

Grunet commented Apr 15, 2022

Ran into this just now with the aws sdk.

Was wanting to limit to something like cloudformation.*.amazonaws.com, where the wildcard would match the region

@erisanolasheni
Copy link
Author

Hi @ry this issue has been open for 2 years and we haven't heard any positive response about it, anything going on with this?

@bartlomieju
Copy link
Member

There is no movement on this front whatsoever. I will raise this topic on the next design meeting.

@erisanolasheni
Copy link
Author

Okay, thanks for your concern.

@bartlomieju
Copy link
Member

While this is not a priority for the core team, we would be happy to accept a PR that implements wildcard matching for --allow-net flag.

@Grunet
Copy link

Grunet commented Apr 28, 2022

Am I on base in thinking that the changes would be in this permissions.rs file, specifically UnaryPermission<NetDescriptor>'s 3 "check" methods (check, check_url, and check_all)?

I don't really know Rust (or how to read it...) but that's where I got to after some code tracing.

@ShriPunta
Copy link

Eagerly waiting for this!

The domains allowed in my deno.json are : --allow-net=<few_others>,salesforce.com
I thought that allowing a top-level domain like salesforce.com should resolve all the subdomains
but yet during runtime when i try to do a fetch, it asks me this:

┏ ⚠️  Deno requests net access to "some-custom-domain-dev-ed.my.salesforce.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) > 

@McSneaky
Copy link
Contributor

Not having it makes it almost impossible to connect to multi-region services. Like for example Discord has about thousand subdomains depending on location: gateway-us-east1-a.discord.gg, gateway-us-east1-b.discord.gg, gateway-us-east1-c.discord.gg, finland10057.discord.gg, finland10063.discord.gg, bucharest1832.discord.gg etc

Similar stuff with several other more enterprisey software, like GCP, AWS etc. It's hard to pinpoint down all the subdomains

Easy route is to do just --allow-net and give access to everything, but this also gives access to internal.gov, malicious.site etc making whole net security layer useless

@nayeemrmn nayeemrmn linked a pull request May 16, 2025 that will close this issue
@nayeemrmn nayeemrmn self-assigned this May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli related to cli/ dir suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants