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

Tokens aren't hashed and salted before being stored #13

Open
willjvsmith opened this issue Dec 24, 2018 · 1 comment
Open

Tokens aren't hashed and salted before being stored #13

willjvsmith opened this issue Dec 24, 2018 · 1 comment
Labels
design flaw For future improvement

Comments

@willjvsmith
Copy link
Member

willjvsmith commented Dec 24, 2018

Should be hashed and salted the same as account passwords.

@willjvsmith willjvsmith added the bug Something isn't working label Dec 24, 2018
@willjvsmith
Copy link
Member Author

willjvsmith commented Dec 29, 2018

This was addressed in commit (fd2cc2a), however was then reverted after discussion with @jaylees14 .

The problem is that since only a token is sent for authentication, it must be checked against all tokens in the token table. If all tokens are hashed for storing, then the incoming token must be compared to each hashed token using bcrypt. This is not performant, so for now tokens will be stored in plain text. This is viable for the MVP since the quantity of token entries will be low. In the future it makes sense to implement the system using JWT (JSON Web Tokens), which encodes the username/user ID in the token, making lookup efficient.

For future reference:
https://github.com/dgrijalva/jwt-go

@willjvsmith willjvsmith added design flaw For future improvement and removed bug Something isn't working labels Dec 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design flaw For future improvement
Projects
None yet
Development

No branches or pull requests

1 participant