-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Where to store token securely? #1281
Comments
I don't have experience with HttpOnly cookie, but can you submit a PR changing the docs suggesting the best security recommendation according to you? |
This gem provide the secure token, how you want store it, it's a completely different stuff, in a single page application context is correct to store the token on the local/session storage, according to your needs, you can also put in the cookie, but it's just the same level of security, a cookie can be also stolen on the client side. If you want more security you can just encrypt your local storage data, but it's a false sense of security, because you will need the key for decrypt the stuff, and it's also on the client side. If you want stuck with the token in a cookie, I suggest you to use the standard Devise gem. using a cookie for the authentication facilities that this gem offers, does not makes sense, just imagine the process of change the authentication token and other 'headers' stuff, of this gem, and at each request recreating the cookie, it's just an overkill and overhead. |
@MaicolBen I also never experience HttpOnly cookie as I use this gem for years. But recently I research deep on this on the internet, I can see HttpOnly cookie is the cookie that can only read on the server. So no one on client side can access it. Every request browser will attach this kind of cookie to the server automatically. I try to read docs and review the source. Seem like it no way to have this kind of security in this gem yet. Also, currently I try to implement it by myself. But it need ton of customization. That why I come to ask the suggestion from community. If anyone use to take care of this security by simplify? |
@CDimonaco Actually, it is not completely different staff. It is the same the way you provide a secure token and there is no way to store that secure token by the way you provide. If you work with Mobile application, it is ok to store that kind of token on the client side. But if you working with single page application it is the scary part.
I think we should concern the way provide the secure token in order be more secure. What is your idea? Let's me know |
@Uysim I'm also interested in knowing the best way to handle this. All of the clients I've built for this store the tokens in The issue with
So if I understand the issue correctly, The problem with I would like it if someone could provide a detailed explanation of how this kind of exploit would happen. That would make it easier for us to gauge the severity of this problem. I am interested in finding a way to use |
@lynndylanhurley An interesting side note about using an HTTP cookie over See this bit from the MDN docs on cookies:
|
Thinking this could work behind a config switch without a whole lot of hassle. |
Here is a PR I'm working on to support using |
Now that the the aforementioned PR has merged, we should also make the necessary changes to allow only a domain cookie to be used. By doing that, we'll accomplish the security aspect of using an |
I have been review this #1005 the answer in this issue is not correct. We need to guide the way to handle token securely on client side. Nothing I know from this gem to store token securely.
I think the better way is to handle token with HttpOnly cookie
The text was updated successfully, but these errors were encountered: