Skip to content
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

Proposal: --allow-net-fetch (fetch-only net permissions) #22902

Open
teleclimber opened this issue Mar 13, 2024 · 1 comment
Open

Proposal: --allow-net-fetch (fetch-only net permissions) #22902

teleclimber opened this issue Mar 13, 2024 · 1 comment
Labels
cli related to cli/ dir permissions related to --allow-* flags suggestion suggestions for new features (yet to be agreed)

Comments

@teleclimber
Copy link

teleclimber commented Mar 13, 2024

I don't know how the net permissions will be improved in Deno 2.0 (or if they will?) but I would like to make this suggestion:

Add a permission that allows net access via fetch only.

Why?

First, it would cover a large majority of use cases, where code just needs to make HTTP requests. Unlike --allow-net it doesn't allow a server to listen (see #16532) and you can't use it to start TELNET session to probe for network services.

Second, when used in combination with `HTTP[S]_PROXY, it would guarantee that all net requests go through the proxy. This is useful if you want to allow net requests, but you need to monitor them and provide additional filtering.

Currently, you can use HTTP_PROXY to filter or monitor fetches, but nothing prevents malicious code from bypassing the proxy using Deno.connect. With --allow-net-fetch, net activity initiated with Deno.connect gets blocked (unless allowed using --allow-net).

In other discussions, Deno team members have recommended that Deno be run with its own networking namespace to cover this requirement (#11925 (comment)). However this implies a Linux environment and rules out using this on local machines running Mac or Windows. With --allow-net-fetch you don't have to be on Linux (and you don't have to mess with namespaces, which can be prickly).

There are a number of reasons why systems may want to filter net requests beyond what Deno currently allows:

It would be great if Deno could offer a simple cross-platform way to monitor/block fetches.

Thank-you for considering!

✌️

@lucacasonato lucacasonato added suggestion suggestions for new features (yet to be agreed) 2.0 triage required cli related to cli/ dir permissions related to --allow-* flags labels Jun 12, 2024
@lucacasonato
Copy link
Member

We don't think this is a breaking change to add, so we are not going to do this for Deno 2. We do however se the usecase, and may do this in a later release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli related to cli/ dir permissions related to --allow-* flags suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

No branches or pull requests

2 participants