-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Introduce ability to update HashAlgo #14751
Conversation
- Add Defaults in settings - Add Flag to Update Password on next use in settings - Create Crypto-Fallbacks in structs - Update Hashing Generation
- Introduce hashing module with 4 submodules, one for each hashing algo - Migrate User table: - Update Password format - Remove HashAlgo field - Remove all usages of passwdHashAlgo field - Update config file - Update all usages of password verification - Update the detection of password resetting need - Set defaults if hashing conf is n/a in config file - Update user fixture to mirror changes - Append user in fixture with not-default password setting - Update test for the changes above
# Conflicts: # models/migrations/migrations.go # models/migrations/v172.go # models/user.go
- Fix CR by @lunny - Revert migration to User table - Revert remove all usages of passwdHashAlgo field - Update relevant parts for password setting to write passwdHashAlgo
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.
I think we need to do the configuration slightly differently but we're getting there!
Documentation changes could be added on this PR. |
Thanks to both of you for the inputs. Will continue implementing this weekend. |
Signed-off-by: Andrew Thornton <art27@cantab.net>
Add password_hash options to - config-cheat-sheet - /admin/config - default ini Add passing of error if hashing fails
@boppy please resolve conflicts |
Will do it this weekend. |
# Conflicts: # custom/conf/app.example.ini # models/fixtures/user.yml # routers/install/install.go # routers/web/user/setting/account.go
@boppy |
* Make all hash related parameters optional * Set fallback parameters for each algo * Note in ini that all params (per algo) have to be defined in order to be used * Comment out ini entries * Reorder imports in install.go
please resolve conflicts |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions. |
This PR refactors and improves the password hashing code within gitea and makes it possible for server administrators to set the password hashing parameters In addition it takes the opportunity to adjust the settings for `pbkdf2` in order to make the hashing a little stronger. The majority of this work was inspired by PR go-gitea#14751 and I would like to thank @boppy for their work on this. Thanks to @Gusted for the suggestion to adjust the `pbkdf2` hashing parameters. Close go-gitea#14751 Signed-off-by: Andrew Thornton <art27@cantab.net>
…ea#22942) Backport go-gitea#22942 This PR refactors and improves the password hashing code within gitea and makes it possible for server administrators to set the password hashing parameters In addition it takes the opportunity to adjust the settings for `pbkdf2` in order to make the hashing a little stronger. The majority of this work was inspired by PR go-gitea#14751 and I would like to thank @boppy for their work on this. Thanks to @Gusted for the suggestion to adjust the `pbkdf2` hashing parameters. Close go-gitea#14751 Signed-off-by: Andrew Thornton <art27@cantab.net>
This PR refactors and improves the password hashing code within gitea and makes it possible for server administrators to set the password hashing parameters In addition it takes the opportunity to adjust the settings for `pbkdf2` in order to make the hashing a little stronger. The majority of this work was inspired by PR #14751 and I would like to thank @boppy for their work on this. Thanks to @Gusted for the suggestion to adjust the `pbkdf2` hashing parameters. Close #14751 --------- Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
#22943) Backport #22942 This PR refactors and improves the password hashing code within gitea and makes it possible for server administrators to set the password hashing parameters In addition it takes the opportunity to adjust the settings for `pbkdf2` in order to make the hashing a little stronger. The majority of this work was inspired by PR #14751 and I would like to thank @boppy for their work on this. Thanks to @Gusted for the suggestion to adjust the `pbkdf2` hashing parameters. Close #14751 --------- Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
After discussions on discord, I implemented the ability to set the Hashing Algo more freely. Including any param for any of the available HashAlgos. This is my first ever PR to gitea (or any go project), so please patient with me ;)
In particular:
Update Hashing Generation and Storage
The password hash now also includes the parameters that have been used to create the hash. This is needed, because the params a volatile now.
Add Defaults in settings
Those follow the current set of settings.
Add Flag to Update Password on next use in settings
If this setting is set, gitea will update the user password to match current settings the next time a password validation takes place (and succeeds, for sure)
Create Crypto-Fallbacks in structs
Created a struct where the fallback config for any of the available hash algos is saved. This is needed in order to verify passwords that are not stored using the newly inserted logic
Some questions are still needing discussion (beside the question if my approach even matches coding standards used):
Should I provide error handling here?
Should (how?) I provide any swagger related contents here - I just copied the sources and kept the swagger comment.
Should each and every of the aspects be integrated into the config file? I did not add any by now, but prepared it
Regarding (3) I would totally opt in for making every aspect configurable. It could be
[security.password]
or justpasswords
.