-
Notifications
You must be signed in to change notification settings - Fork 284
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
Use HttpOnly
attribute for vibe.http.session
by default
#368
Comments
Use `HttpOnly` attribute for `vibe.http.session` by default, see #368
Regarding the |
Note that we can use proxy like Nginx. For example, Nginx will be use SSL connection for client, and Vibe.d will use no-SSL connection for local network. So, in that case we need option to force using |
Sure, the current After a while, the old boolean based overload would then get deprecated. |
Actually, since using the |
No, it's dangerous. I can change Have we got
Also, it would be nice to have the same options for all cookies. So, we should name it |
Also, we should add warning if people use both SSL and no-SSL connections. |
There are a few problems with that approach. The first is backwards compatibility, even my suggestion would break certain use cases, but it would be fairly non-intrusive. The other issue is that the fact that there is an HTTPS listener doesn't mean that it's related to the listener used to start the session. However, assuming that both listeners are related, your approach seems to be exactly the same. If there is only SSL support, there is no way to generate a non-SSL URL and if both SSL and no-SSL are supported, you still infer it from the request protocol. Of course, the programmer needs to make sure that the login request (or whatever starts the session) happens over HTTPS whenever both HTTP and HTTPS are possible, but if that isn't the case, the session ID is the smallest problem. |
I don't know. It may be perfectly fine to have both. Going by that logic it would make more sense to warn when only no-SSL is present. |
Not exactly. Vibe.d can't accept no-SSL request if it have only SSL support. But client CAN sent the data via no-SSL protocol and hacker can analyze it. So, if hacker can send no-SSL request (for example, via JavaScript) and have traffic sniffer he CAN compromise the session Id. Note that |
How would that no-SSL request result in a started session if it isn't accepted by vibe.d? |
Hacker doesn't need vibe.d result. He need browser request. Also, hacker can use additional exploits to substitute HTTP server - DNS security issues come to mind first: Also, BGP protocol had issues. So, we shouldn't think that it's impossible. |
Huh? But we are talking about inferring the |
Yes, we are. But hacker can use multiply issues. |
So how exactly would a hacker manipulate the |
He can access only to encrypted data. If hacker send no-SSL request browser will NOT send session Id. It means that hacker will NOT receive session Id If we assume that SSL is secure. |
Sorry, I still don't understand where you see the problem with my proposal (to use the request protocol for inferring server: vibe.d with "/login" starting the session. "/login" is only available using HTTPS requests. browser -> hacker -> server What can the hacker now do to talk the server into sending no |
Yes, you are right. I thought we talk about two different cases, Question: what happens if I send |
Okay, I'll switch to using an enum then. We can still resolve any remaining issues afterwards before the next release (probably easier to reason about actual code, I guess).
It will fail with a local exception in the |
If I use Maybe we should add two different warnings for both |
It may be valid though to have both, if either the non-SSL version uses a completely different request handler, or if there is a router entry that makes certain routes unavailable for non-SSL access (could also require authentication at the same time):
My feeling is just that on this level, there are so many things that can be done right or wrong, that emitting a warning may just be annoying if the programmer knows what he is doing, or worse, that it creates a false sense of security when the warnings have been avoided. Maybe this would be an opportunity for a small framework that is layered on top of the current low-level one. This framework could then for example provide the complete encryption/authentication/authorization pipeline and make sure that everything is done right. |
… an SSL connection. See #368. Also introduces a new overload for HTTPServerResponse.startSession that takes SessionOption enum instead of boolean values.
No, you are wrong. |
You mean a MiM attack that changes if we send |
OK, assuming that we have Attack example:
Note that without |
Please reread my previous comments. We have to assume that the login page is only available using an SSL connection. If the hacker can sniff the login credentials, then who cares about the session ID? |
Yes, you are right.
You tell me that it's possible to have both SSL and non-SSL protocols as valid configuration. I disagree with you and provide attack example. I don't tell that it's easy, but still possible in theory. |
I think it is a valid configuration, as long as critical pages are only available using SSL (e.g. using the method in #368 (comment)). But my point is that this is an issue that has nothing to do with the |
Yes, I agree that problem has broader scope. |
We should use
HttpOnly
attribute by default for sessions.It helps to prevent XSS attacks because session Id will not be available for JavaScript. Also, it's something wrong if you really need to use session Id from JavaScript.
http://en.wikipedia.org/wiki/HTTP_cookie
Also, we should use
Secure
attribute for SSL connections by default. It allows to send session Id only via SSL.The text was updated successfully, but these errors were encountered: