-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Disallow HTTP by default #7004
Comments
Already discussed in #1063. Deno allows HTTP imports just like browsers: #1063 (comment) |
Browsers allow networking by default but deno doesn't. So why disallowing a widely known security issue is any different? |
We have #5680 but it doesn't apply to runtime We shouldn't disallow http, nor should it require a flag as long as https -> http downgrades are disallowed (if you don't import http in the code you control then nothing else can) but maybe it should also apply to runtime |
Not knowing how to do something shouldn't be a blocker, but good points. |
This comment has been minimized.
This comment has been minimized.
@agamm Is talking about HTTP communication in general not just imports. |
Oops, I forgot what I wrote above :P |
On one of the other issues I suggested enabling scheme-based fine-grained allows, so you can do --allow-net=https://* to only allow https (or =amqps://* to only allow AMQP over TLS, etc.) |
That sounds great, can you link it? |
See discussion here: #6532 |
Just to clarify, it doesn't related to the "By default" part we are talking here, only an implementation, right? |
Right, this isn't about "by default", just about providing the users with the abilities to impose limitations such as "disallow HTTP". Currently there is no way to disallow HTTP but allow HTTPS. My opinion is that we shouldn't make HTTP an exception (no need for a new command-line switch).
|
Imposing default secure configurations isn't something you think is necessary? and allowing to add exceptions afterwards? |
The default is secure: no network is allowed. |
When in a secure context (HTTPS) in a browser, importing from HTTP is disallowed. |
I can't find anything in the documentation about this specifically, but in this example from the manual : const url = Deno.args[0];
const res = await fetch(url);
const body = new Uint8Array(await res.arrayBuffer());
await Deno.stdout.write(body); They demonstrate how the script will fail without the
Just for fun, I tried hitting Google, changing the domain to
You'll see that the error suggests running the command again with the This thread seemed like a good place to ask about it — anyone know why this might be happening? For reference, I get the same error when the domain passed to At the very least it seems like the error message could be improved? |
@ellismarkf
|
Yeah I am getting this error.. the tutorial doesnt really work, which is not good.
Here is my server.ts code:
|
@hagenek Your command should be |
You mean |
@crowlKats that works, thanks! Feel like a newbie.. |
@hagenek no worries. FYI: all flags related to the deno cli have to be put before the path of the file you want to run. everything after the path gets passed to the script and is accessible via |
We're not going to change this to be disallowed by default. However, a PR that enables |
Considering the main title of deno: "A secure runtime for JavaScript and TypeScript." it seems wise to disallow HTTP by default, thus requiring https for all external interactions.
I know this might hinder local development speed, but it shouldn't be any different than accessing the fs or the network (in the same way it is done at the moment).
A reasonable approach would be to add a
--allow-http
or--insecure-http
when needing HTTP (not secure).If there is a strong opinion against it at least a warning should be helpful.
Version:
To reproduce
Note: I tried searching for a corresponding issue but couldn't find one, please close if this is indeed a duplicate 🙏
The text was updated successfully, but these errors were encountered: