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

Session token is related to the user agent string #713

Closed
Massedil opened this issue Nov 26, 2022 · 7 comments
Closed

Session token is related to the user agent string #713

Massedil opened this issue Nov 26, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@Massedil
Copy link

Describe the bug
Session token is related to the user agent string.
I'm not sure it is useful, from security point of view.
It is annoying when I'm in Firefox Developers Options "adaptative view".
I imagine you also lost your session when the browser is upgraded.

Expected behavior
The session token is not related to the user agent string.

Screenshots

Jeton invalide

Please complete the following information:

  • Browser: Firefox
@the-djmaze
Copy link
Owner

The token contains your username and password.

If we would store that info on server, everyone might could read it (based on security of server or hacked).

So the data is encrypted with a salt from server and your user agent token.

This way when data is logged or backup, someone needs to know more then just server salt.

It is just a way to secure it better and protect data.

@the-djmaze
Copy link
Owner

P.S. you can also read here why i made changes.
RainLoop#2134

@Massedil
Copy link
Author

So the data is encrypted with a salt from server and your user agent token.

For me, user agent is not unguessable at all ; you can quickly try a brute force with the most common and updated browser user agent. What do you think about it?

Can't we use a random string generated by the JavaScript client and stored in the local session instead of the user agent ?

@the-djmaze
Copy link
Owner

the-djmaze commented Nov 28, 2022

There you go 😉
It uses Web Crypto API for "true" randomness.
And is the only function that works in an insecure context (http vs https) for people who are running SnappyMail local without https.

When localStorage or crypto.getRandomValues() fails, it will fall back to the User-Agent string

@Massedil
Copy link
Author

So if it is a fallback to use the user agent instead of random values, it means something is not working for me ? How can I investigate to know what the problem is ? (Fail of localStorage or crypto.getRandomValues() ?)

@the-djmaze
Copy link
Owner

No, i've added your idea for next release

@the-djmaze the-djmaze added the enhancement New feature or request label Nov 28, 2022
@Massedil
Copy link
Author

No, i've added your idea for next release

Sorry I have missed you commit ! Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants