Skip to content

fix(auth): map password policy violation error - #3291

Merged
lahirumaramba merged 5 commits into
firebase:mainfrom
sean0407:codex/firebase-admin-node-3265-password-policy-error-20261020
Nov 9, 2026
Merged

lahirumaramba merged 5 commits into
firebase:mainfrom
sean0407:codex/firebase-admin-node-3265-password-policy-error-20261020

Conversation

@sean0407

@sean0407 sean0407 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Map PASSWORD_DOES_NOT_MEET_REQUIREMENTS to the public auth/password-does-not-meet-requirements error code.
  • Add a focused regression test for the server mapping and default error message.

Evidence

  • Before the fix, FirebaseAuthError.fromServerError('PASSWORD_DOES_NOT_MEET_REQUIREMENTS') returned auth/internal-error; the regression failed with that result.
  • The regression now verifies auth/password-does-not-meet-requirements and its default message.
  • An automated review suggested preserving the contiguous INVALID_* block and asserting the default message. Both suggestions were applied in commit 26cff32.
  • test/unit/utils/error.spec.ts: 26 passing.
  • npm run build: passed.
  • ESLint on both changed files and git diff --check: passed.
  • npm run test:unit: 6,147 passing, 8 failing. Failures are HTTP/2 session error assertions in test/unit/utils/api-request.spec.ts and test/unit/messaging/messaging.spec.ts.

Merge Danger

Door: two-way

Blast Radius: limited to the Auth server error mapping for this response code.

Fixes #3265

@sean0407
sean0407 requested a review from a team October 19, 2026 22:24

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a new error code, PASSWORD_DOES_NOT_MEET_REQUIREMENTS, to handle password policy violations, along with its client-side mapping and a corresponding unit test. The feedback suggests reorganizing the placement of the new error code and its configuration in src/auth/error.ts to avoid breaking the contiguous block of INVALID_ error codes, and adding an assertion for the error message in the unit test to ensure consistency.

Comment thread src/auth/error.ts Resolved
Comment thread src/auth/error.ts Resolved
Comment thread test/unit/utils/error.spec.ts Resolved

@lahirumaramba lahirumaramba left a comment

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.

Thank you for your contribution!

Could you run npm run api-extractor:local and commit the updated etc/firebase-admin.auth.api.md`?

Comment thread test/unit/utils/error.spec.ts Resolved
sean0407 and others added 2 commits November 6, 2026 21:06
Record PASSWORD_DOES_NOT_MEET_REQUIREMENTS in the auth API report and
assert the production server form keeps its details suffix.

Co-authored-by: sean0407 <[email protected]>
@lahirumaramba
lahirumaramba merged commit f413192 into firebase:main Nov 9, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Password policy violation is reported as auth/internal-error instead of a specific error code

2 participants