Skip to content

fix(users): stop a blocked user from impersonating - #15021

Merged
ChiragAgg5k merged 2 commits into
mainfrom
fix/blocked-impersonator
Oct 28, 2026
Merged

ChiragAgg5k merged 2 commits into
mainfrom
fix/blocked-impersonator

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

The blocked check on HTTP requests looked at the impersonation target, so a blocked user holding the impersonator capability and a live session kept access by impersonating any active user. A blocked actor no longer resolves an impersonation, so the check sees the actor itself, as realtime connections already do.

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

Related: appwrite-labs/cloud#6666

The blocked check on HTTP requests looked at the impersonation target,
so a blocked user holding the impersonator capability and a live session
kept access by impersonating any active user. A blocked actor no longer
resolves an impersonation, so the check sees the actor itself, as
realtime connections already do.
@luxor-code-review

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

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


This PR blocks impersonation requests when the acting (impersonating) user has a blocked status, closing a trust-boundary gap where suspended users could still issue impersonated sessions.

Files Change
app/init/resources/request.php Wires the impersonatorUser resolution to reject requests when the impersonator's status is blocked, returning the user_blocked error instead of minting an impersonated session.
tests/e2e/Services/Users/UsersBase.php Adds e2e cases asserting that a blocked impersonator receives 403 on the account impersonation paths after their status is updated via PATCH /users/:id/status.

The gate consistently covers the header and query-param impersonation paths, and the injected impersonatorUser dependency list is unchanged so worker/CLI contexts remain safe. No high-severity issues surfaced in review.

Reviewed commit: b07722d

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

ghost commented Oct 27, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The changed guard routes blocked actors into the existing blocked-user check, and the regression test covers both HTTP impersonation input paths.

HTTP impersonation resolution now returns no impersonator for a blocked actor, allowing the existing authorization check to reject the actor instead of applying the target user. The Users E2E suite covers impersonation through both the header and query-parameter paths before and after blocking the actor.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 2
File Change
app/init/resources/request.php Prevents blocked users from resolving an HTTP impersonation target.
tests/e2e/Services/Users/UsersBase.php Adds E2E coverage for blocked impersonators using header and query-parameter impersonation.

Merged main (b0926ac); no changes to this PR's code since b07722d · 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 S · Looks good to merge. Summary

@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

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/blocked-impersonator (after).

Metric Before After Change
🚀 Requests/sec 198.81 204.92 ⚪ +3.1%
⏱️ Latency P50 84.37 ms 84.04 ms ⚪ -0.4%
⏱️ Latency P95 208.55 ms 199.81 ms ⚪ -4.2%
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 84.04 199.81 12,711 204.92 -8.74
Account 152.95 287.65 669 11.08 -30.52
TablesDB 80.73 147.2 6,913 113.05 -7.08
Storage 78.49 191.91 3,345 56.92 -7.51
Functions 117.64 240.62 1,784 31.19 -10.64

Top API waits (after)

API request Max wait (ms)
functions.create 436.4
account.prefs.update 407.22
functions.variables.update 393.88
account.name.update 393.19
functions.variables.create 382.5

@ChiragAgg5k
ChiragAgg5k merged commit 82d1862 into main Oct 28, 2026
68 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix/blocked-impersonator branch October 28, 2026 11:43
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