Skip to content

fix(login): add backend password validation to match frontend requirements#3070

Open
aicontentcreate2023-star wants to merge 6 commits into
AntaresSimulatorTeam:devfrom
aicontentcreate2023-star:fix/password-validation-backend
Open

fix(login): add backend password validation to match frontend requirements#3070
aicontentcreate2023-star wants to merge 6 commits into
AntaresSimulatorTeam:devfrom
aicontentcreate2023-star:fix/password-validation-backend

Conversation

@aicontentcreate2023-star
Copy link
Copy Markdown

Fixes #3067

Fixes AntaresSimulatorTeam#3067

Adds server-side password strength validation in UserCreateDTO to ensure
consistent security policy whether users are created via UI or API.

Validation rules (matching frontend):
- Length: 8-50 characters
- At least one lowercase letter (a-z)
- At least one uppercase letter (A-Z)
- At least one digit (0-9)
- At least one special character (!@#$%^&*(),.?":{}|<>)

Previously, the frontend enforced these rules but the backend accepted
any password, allowing scripts/API calls to create users with weak
passwords. This fix ensures the same security standards apply regardless
of the creation method.
@sylvlecl
Copy link
Copy Markdown
Member

sylvlecl commented Mar 3, 2026

Yes ?

@TheoPascoli TheoPascoli changed the base branch from master to dev March 4, 2026 08:06
Copy link
Copy Markdown
Member

@sylvlecl sylvlecl left a comment

Choose a reason for hiding this comment

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

Please add some unit test to ensure no regression in the future.

Comment thread antarest/login/model.py

@field_validator("password")
@classmethod
def validate_password_strength(cls, v: str) -> str:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would need some unit tests

@gitguardian
Copy link
Copy Markdown

gitguardian Bot commented Apr 8, 2026

⚠️ GitGuardian has uncovered 8 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
- - Generic Password 937e29e tests/integration/studies_blueprint/test_get_studies.py View secret
31568767 Triggered Generic Password 937e29e tests/login/test_web.py View secret
- - Generic Password 937e29e tests/integration/test_integration.py View secret
- - Generic Password 937e29e tests/integration/studies_blueprint/test_get_studies.py View secret
- - Generic Password 937e29e tests/login/test_login_service.py View secret
14433192 Triggered Authentication Tuple c6ba36c antarest/dependencies.py View secret
31568767 Triggered Generic Password f93cde9 tests/login/test_model.py View secret
31568768 Triggered Generic Password f93cde9 tests/login/test_model.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@TheoPascoli TheoPascoli changed the title fix: add backend password validation to match frontend requirements fix(login): add backend password validation to match frontend requirements Apr 24, 2026
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent password validation between frontend and backend user creation

3 participants