Repository navigation
Add password complexity enforcement via zxcvbn #23996
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,9 @@ | |
| :locked_account_timeout: 2.minutes | ||
| :amazon_key: | ||
| :amazon_secret: | ||
| :password_rules: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i structured it this way because I plan to add Would like your thoughts on naming here.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Linux calls this password quality (https://linux.die.net/man/5/pwquality.conf), password rules is good too though
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My only thought here is do we expect to use these rules on things other than passwords? Maybe more generic
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question - I don't think so. This is very specifically for database auth passwords. All other passwords and secrets we have come from outside sources so we can't control them. |
||
| :complexity_min_score: 3 | ||
| :complexity_extra_words: [] | ||
| :binary_blob: | ||
| :keep_orphaned: 1.month | ||
| :purge_window_size: 100 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| --- | ||
| :authentication: | ||
| :password_rules: | ||
| :complexity_min_score: 0 | ||
| :log: | ||
| :level_rails: debug | ||
| :webservices: | ||
|
|
||
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.
Do we check the validity of the password in the UI if the password isn't strong enough? It might be easier to check it earlier than at save time.
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.
We check the validity on change password (so that's create or update). This line was interesting, but the way
has_secure_passwordworks,:passwordis not a real attribute stored in the database. It only has a lifetime when someone sets the value in the object, which will only happen if someone intends to change it. Any other time, such as when you query the User object, the:passwordisnil. So this line really says, "if someone sets the password attribute, then run the validation on save". This allows other non-password changes, such as an email change to not trigger the complexity heck, thereby allowing existing passwords to be considered "ok". I intentionally did not want to prevent upgrades or settings changes from suddenly breaking all existing passwords (even, potentially, the super-admin password).I will have a follow up PR allowing super-admins to force password changes on demand, and my intention is to create a tool that an admin can run to audit all passwords against the rules and force a password change. This allows the admin to opt-in to that for existing passwords / users.
Uh oh!
There was an error while loading. Please reload this page.
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.
If you're asking whether we could update the UI to do strength checks right in the UI - I think so, but that will be a follow up "nice to have". I am concerned we would need the same strength checks on both sides, so I'm not sure how that would work.
EDIT: Actually yeah, I'm pretty sure we can do that. zxcvbn is actually dropbox's algorithm and it's been ported to all the languages. That link is the original javascript version we could use on the UI side, and have a strength checker ahead of time. See also https://upmostly.com/tutorials/build-a-password-strength-meter-react