Skip to content

fix(user): same answer and time whatever the account, on reset and login - #2835

Merged
lbesson merged 1 commit into
masterfrom
fix/account-enumeration
Dec 3, 2026
Merged

lbesson merged 1 commit into
masterfrom
fix/account-enumeration

Conversation

@lbesson

@lbesson lbesson commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

What

Password reset request (/users/request_password_change): the same answer, 200 {}, whatever the address.

  • no account, or a blocked one: no email;
  • an account not validated yet: the link of the registration again (it used to answer an error);
  • a validated account: the reset link, as before.

The email is sent once the change is committed, in a thread (as the forum calls), so the time of the answer does not depend on the account; a failure to send is logged. The limit of reset emails now counts per address (its hash in the Redis key), whether an account uses it or not.

Login: an unknown name is checked against a dummy bcrypt hash of the same cost, and the password of an account not validated yet is checked too: every failure takes the time of a check. The answers were already the same.

Not changed: the registration still says when an email or a name is taken (the form needs it; the captcha limits it).

UI

c2c_ui companion PR c2corg/c2c_ui#5393: the message after a reset request no longer says "Mail has been sent". Either can deploy first.

Tests

New tests for each case above (they fail on master). In the tests, the emails of the resets are sent inline (autouse fixture).

🤖 Generated with Claude Code

- A password reset request answers 200 whatever the address: no
  account, a blocked one (no email), one not validated yet (the link of
  the registration again), a validated one (the reset link).
- The email goes once the change is committed, in a thread: the time
  of the answer tells nothing either; a failure is logged.
- The reset limit counts per address (a hash in the key), known or not.
- Login checks a password against a dummy hash when no account has the
  name, and checks the password of an account not validated yet: the
  same time in every case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1555a959-7d4f-4aac-bc35-c8e46d794d39
Commits

Reviewing files that changed from the base of the PR and between 18b4e82 and c076c06.

Files selected for processing: 7

  • c2corg_api/models/user.py
  • c2corg_api/security/rate_limiting.py
  • c2corg_api/security/roles.py
  • c2corg_api/tests/conftest.py
  • c2corg_api/tests/security/test_anonymous_rate_limiting.py
  • c2corg_api/tests/views/test_user.py
  • c2corg_api/views/user.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 7 complexity · 0 duplication

Metric Results
Complexity 7
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@lbesson
lbesson merged commit 7f3e27c into master Dec 3, 2026
4 of 6 checks passed
@lbesson
lbesson deleted the fix/account-enumeration branch December 3, 2026 11:09
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.

1 participant