Repository navigation
fix(auth): stop PersonalData from mutating its own state while validating - #13532
Merged
Merged
Conversation
…ting isValid() lowercased the userId, email, name and phone properties in place whenever strict mode was off, so the validator carried state from one call into the next. Lowercase the values into locals instead, leaving the instance reusable and side-effect free.
Contributor
Greptile SummaryThis PR prevents non-strict personal-data password validation from mutating the validator’s stored fields.
Confidence Score: 5/5The PR appears safe to merge, with no outstanding correctness or security findings. The validation logic preserves the prior comparisons while eliminating mutation of stored validator state. The previous test-related finding was manually resolved without explanation and does not remain outstanding. Important Files Changed
Reviews (6): Last reviewed commit: "Merge branch 'main' into fix/personal-da..." | Re-trigger Greptile |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Asserting only isValid() results could not catch the regression: lowercasing in place is idempotent, so the mutating version returned the same answers. Read the fields back through a named subclass instead, and use a password long enough to clear the password rules so validation reaches the block that mutated them.
The mutation is invisible through isValid(): lowercasing in place is idempotent, so the mutating version answers every public call identically. Behaviour-only assertions pass against the code this PR removes, which leaves the fix unguarded. Read the fields back through a named subclass, the same way ActivateRulesTest reaches a protected member. AGENTS.md rules out reflection, not subclasses.
ArnabChatterjee20k
approved these changes
Sep 8, 2026
2 tasks done
2 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11895
What does this PR do?
Lowercases local copies of personal data during non-strict password validation instead of modifying the validator's stored fields. Password acceptance behavior stays the same.
Test Plan
The existing strict and non-strict validator tests pass: 2 tests, 47 assertions. The test-only subclass that exposed protected fields was removed; the suite retains its public validation assertions. Pint and PHP syntax checks passed.