Skip to content

Strengthen password policy#868

Merged
ignatiusm merged 47 commits into
devfrom
867-strengthen-password-policy
Jul 22, 2026
Merged

Strengthen password policy#868
ignatiusm merged 47 commits into
devfrom
867-strengthen-password-policy

Conversation

@ignatiusm

Copy link
Copy Markdown
Contributor

Resolves #867

Updated checkPasswordStrength function to:

  • increase min char length (379e15a)
  • exclude commonly used base words (781b757)

This causes backend auth tests to fail (therefore verifying those changes are good):
image

@ignatiusm
ignatiusm marked this pull request as draft June 25, 2026 02:36
@ignatiusm
ignatiusm marked this pull request as ready for review July 8, 2026 05:14
@ignatiusm

Copy link
Copy Markdown
Contributor Author

Note: as per this slack conversation, this PR leaves the demo site password hard coded in three places:

  • application/backend/.env.example
  • README.md
  • .helm/ctrl/templates/cron.yaml

Removing password login from demo mode is one way to address this, but is out of scope for this PR. It also deserves some thought given demo site is publicly deployed 🤔

@plouka13 plouka13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a much needed PR @ignatiusm!

Overall looks great. A few things I think need actioning:

  • studyId: There's a few places that could be updated to use the TestStudies.* object to replace hardcoded values. (I'm aware that some of this might not be necessary because it's creating new studies)
  • Would be good to pull out the common base words into a list that we can easily edit in the future, or, could we use an api here to grab a list of common base words in passwords to check against?

Otherwise looks great! Very happy to have cleaned up the test data importing!

Comment thread application/common/testing/constants.ts
Comment thread application/backend/tests/integration/ResetPassword.test.ts
Comment thread application/admin-client/cypress/e2e/auditLogs.cy.js Outdated
Comment thread application/backend/tests/integration/Survey.test.ts
Comment thread application/backend/src/controllers/ParticipantsController.test.ts
Comment thread application/backend/src/controllers/UsersController.test.ts
Comment thread application/backend/src/controllers/ParticipantsController.test.ts
if (password.length < 14) {
fields.Length = { message: 'Password must be at least 14 characters' }
}
if (/password|welcome|changeme/i.test(password)) {

@plouka13 plouka13 Jul 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to have a const list of base words to allow easier adding in the future. Also should we make this list more exhaustive? However I'm mindful that adding more words to this list could be a hinderance to users.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spotting. I've created the constant and applied it in the appropriate places in abf8ee2

I haven't added to the list though. Did you have other words in mind to add?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Top of my mind I think:
["abc123", "qwerty"]

Otherwise happy to leave as is for now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might move that to another issue, I found a reference list of common passwords: https://en.wikipedia.org/wiki/List_of_the_most_common_passwords

#889

Comment thread application/common/testing/seed.ts
Comment thread application/backend/src/controllers/AuthController.test.ts
@ignatiusm
ignatiusm merged commit 825c87d into dev Jul 22, 2026
6 checks passed
@ignatiusm
ignatiusm deleted the 867-strengthen-password-policy branch July 22, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants