Repository navigation
fix(users): hide credentials from impersonators - #14818
Conversation
The impersonator users.read grant exists for user discovery, so password hashes and hashing options are blanked when that grant is what authorises the read. While impersonating, account identities and sessions no longer carry the target's provider access, refresh and ID tokens. Keys and project admins see these fields as before.
|
Review complete. 🟠 1 high 📍 Findings outside the diff (1) — 🟠 1 high — defects on lines GitHub can't attach comments to🟠 High — Redact MFA
Adds credential redaction for impersonated sessions — masking OAuth provider tokens, password hashes, and hash options in API responses. Redaction is driven by a
Reviewed commit: 7901eeb |
🟢 Tier S · Ready to mergeThis adds credential-marked response fields and replaces password hashes and provider tokens with their model defaults during impersonation or impersonator-only user discovery. It also adds E2E coverage for user, identity, and session responses.
📂 Walkthrough · 8
Reviewed |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
|
@tenki-reviewer Thanks. Recovery codes can't reach an impersonator through either path, so they don't need the |
|
Review complete. No issues found — approved ✅. The change threads credential-hiding through the response layer so secrets are masked when a request is served under impersonation. It updates the response model plumbing and the User, Session, and Identity models to apply the flag, and extends e2e tests for the Account and Users services to cover the new behavior.
Reviewed commit: 7901eeb |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
(cherry picked from commit 3662450)
…dentials fix(users): hide credentials from impersonators (cherry picked from commit 3662450)
What
Response model rules can now be marked
credential. Those fields are reset to their default when the request is impersonating a user, or when theusers.readscope onGET /v1/usersandGET /v1/users/:userIdcomes only from the impersonator grant.Marked fields:
password,hashandhashOptionson the User model,providerAccessToken,providerRefreshTokenandproviderIdTokenon the Identity model, andproviderAccessTokenandproviderRefreshTokenon the Session model.The grant now applies only when the caller does not already hold
users.read, so API keys and project admins who are also flagged as impersonators keep their current view.Compatibility
API keys, console admins and users reading their own identities and sessions see the same fields as before. Impersonators see empty values for the marked fields.
Tests
UsersBase::testImpersonatorUsersReadHidesPasswordHashes: an API key still sees the hash; an impersonator listing or getting a user, with and without an active impersonation, does not.AccountCustomClientTest::testImpersonationHidesProviderCredentials: the user sees their own provider token on identities and sessions; while impersonating that user, the tokens are empty.E2E runs in CI only.
Related: appwrite-labs/cloud#6666