datastorm-open / shinymanager

Simple and secure authentification mechanism for single shiny applications.
https://datastorm-open.github.io/shinymanager/
388 stars 78 forks source link

Passwords should not be stored in plain text #37

Closed AshesITR closed 4 years ago

AshesITR commented 4 years ago

Passwords should never ever be stored in plain. Even encrypting the database does not prevent an admin from seeing the passwords.

Instead, you should use a proper password hashing algorithm such as scrypt to store irreversible password hashes and check if the hash is valid for a provided password in check_credentials.

See here for more information. In the implementation, you only need to use hashPassword() when storing the password and then subsequently use verifyPassword(hash, password) instead of pwd == password.

pvictor commented 4 years ago

Thank you for pointing that out. I'll correct that.

Victor

crotman commented 4 years ago

Yes... this is not good... People use the same password in different services... As an admin of some shiny apps using shinymanager, I set a random password and never ask the user to change it. So he can't put a password that he already uses in other service

The implementation should be as @AshesITR said. And the databases that already exist must be hashed the first time a new version reaches a plain text database

bthieurmel commented 4 years ago

In progress (only for sqlite storage, not for data.frame auth)

bthieurmel commented 4 years ago

Fix on master.

bthieurmel commented 4 years ago

For information, a previous sqlite database is automatically convert to hashed password on first modification on user table (delete / edit / add user).