Skip to content

fix(account): scope the email sign-in limit to the project and address - #15023

Merged
ChiragAgg5k merged 1 commit into
mainfrom
fix/email-signin-limit
Oct 27, 2026
Merged

ChiragAgg5k merged 1 commit into
mainfrom
fix/email-signin-limit

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

The email password sign-in limit keyed its bucket on the raw submitted email without the project, while sign in matches the lowercased email within one project. Case variants of an address each got their own budget, and a successful sign in to the same address in another project reset it. The key now includes the project and email params are lowercased when building abuse keys.

Lint, PHPStan and the touched unit tests passed locally before rebasing on main; e2e runs in CI.

Related: appwrite-labs/cloud#6666

The email password sign-in limit keyed its bucket on the raw submitted
email without the project, while sign in matches the lowercased email
within one project. Case variants of an address each got their own
budget, and a successful sign in to the same address in another
project reset it. The key now includes the project and email params
are lowercased when building abuse keys.
@luxor-code-review

luxor-code-review Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


This PR hardens sign-in abuse limiting by scoping the per-email failure counter to the project making the request, so failed attempts in one project no longer reset or consume another project's budget on shared hosts. The email value used in the abuse key is lowercased so [email protected] and [email protected] share one counter. An e2e abuse test covers the new keying behavior.

Files Change
app/controllers/api/account.php Sign-in abuse key now includes {projectId} and the email placeholder is lowercased before key construction.
app/controllers/shared/api.php Abuse-limit hook unchanged in shape; counters keyed per project as before.
tests/e2e/General/AbuseTest.php E2E test updated to exercise per-project abuse isolation for sign-in.

Reviewed commit: 12d42b1

@ChiragAgg5k ChiragAgg5k self-assigned this Oct 27, 2026
@ghost

ghost commented Oct 27, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

Email/password sign-in abuse buckets now include the project ID, and abuse-key email parameters are lowercased. An E2E test covers email case variants and verifies a successful sign-in in one project does not reset another project's limit.

Verdict New comments Fixed Still open
💬 Commented 0 0 0

Note

Not approving while a bug finding is open: Scope email case folding to case-insensitive handlers

📂 Walkthrough · 3
File Change
app/controllers/api/account.php Adds the project ID to the email/password sign-in abuse key.
app/controllers/shared/api.php Lowercases email values when constructing abuse keys during checks and resets.
tests/e2e/General/AbuseTest.php Adds E2E coverage for case-insensitive and project-scoped sign-in limits.

Reviewed 12d42b1 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Tier A · See the inline comments. Summary

Comment thread app/controllers/shared/api.php Resolved
@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

6 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (3)
  • php.appwrite.secret-compare-timing (1)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@github-actions

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/email-signin-limit (after).

Metric Before After Change
🚀 Requests/sec 204.54 212.01 ⚪ +3.6%
⏱️ Latency P50 83.94 ms 81.44 ms ⚪ -3%
⏱️ Latency P95 201.75 ms 192.31 ms ⚪ -4.7%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 81.44 192.31 13,452 212.01 -9.44
Account 153.16 306.87 708 11.77 +17.89
TablesDB 78.95 142.73 7,316 118.27 -5.02
Storage 74.85 177.52 3,540 58.89 -23.51
Functions 114.02 224.07 1,888 32.07 -14.74

Top API waits (after)

API request Max wait (ms)
account.name.update 552.54
functions.variables.update 437.48
functions.create 393.03
account.prefs.update 362.46
storage.buckets.create 357.37

@ChiragAgg5k
ChiragAgg5k merged commit 39fa26d into main Oct 27, 2026
125 of 127 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix/email-signin-limit branch October 27, 2026 19:18
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