-
Notifications
You must be signed in to change notification settings - Fork 154
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
Implement password salts #7
base: master
Are you sure you want to change the base?
Conversation
I really like the idea of adding salt for the password and your implementation seems to be functionnal (haven't tested it yet but i reviewed the code).
|
|
* Added a salt column to the user table. * Adds a salt to users that have no salted password upon succesfull login. * Salts are now more unique/random * Bug fixed: This commit fixes a bug where a password could by stored to the database in plaintext format by the AdminController->actionUpdate() function, when an admin would supply an unencrypted version of the old password (effectively changing the password to itself, but skipping the encryption methods).
$model->activkey=Yii::app()->controller->module->encrypting(microtime().$model->password); | ||
} else { | ||
unset($model->password); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this unset() is somewhat important, because it makes sure this property is not changed in the database.
When an admin decides to change a users password, but does so by entering the old password (above statement evaluates to false), this property would hold that old password in plaintext form and the save() below would commit that to the database, causing a major security risk (exposing the admin's password) and effectively rendering the account useless because it would become impossible to login again with those credentials.
Ofcourse chances of that happening to another users account are small, but it may very well happen when updating his own account.
This is great! |
True, here it is. |
+1 |
…ted_passwords Conflicts: controllers/RegistrationController.php models/User.php
A salt hasn't to be secret! The main goal of a salt is to stop the hacker from using rainbow table to decrypt the passwords. Using a unique salt for each password will make each hash unique. For me the main problem in Yii-user extension is the use of |
You hit the nail on the spot Darkheir. Alan01252 opened another pull request here, that implements blowfish encryption. I've made some modifications on that and opened a pull request on his repository that implements both this one (my password salts feature branch) and his blowfish feature branch. Please check it out: Alan01252#1. |
In order to minimize the risk of passwords being cracked through rainbowtables, save user passwords in a salted hash to the database.
Edit: See comments below for implementation details.
Please test for yourself again before merging and releasing.