Repository navigation
fix: backport auth and key security fixes to 1.9.x - #14910
Conversation
|
Review complete. 🟠 1 high 📍 Findings outside the diff (1) — 🟠 1 high — defects on lines GitHub can't attach comments to🟠 High — OAuth claim wipes credentials on weak // app/controllers/api/account.php
1641 if (!$isVerified) {
1642 $failureRedirect(Exception::GENERAL_BAD_REQUEST);
1643 }
1644 $user->setAttributes($userWithEmail->getArrayCopy());
1645 if (!$user->getAttribute('emailVerification', false)) {
1646 $authorization->skip(fn () => User::revokeCredentials($dbForProject, $user));
1647 }
1648 // The provider verified this exact address
1649 $user->setAttribute('emailVerification', true);The new verified-email claim path calls The change overhauls API-key handling:
Reviewed commit: 40cee69 |
🟢 Tier S · Ready to merge
This backport hardens authentication and API-key handling across the 1.9.x API, including OAuth account claims, imported password hashes, session/MFA challenges, and project-key permissions. It also ports protections for response filtering, origin and rate-limit handling, membership flows, and internal ephemeral keys, with regression tests for the ported behavior. The latest test adjustment aligns the invite URL in an account-claim regression case with the path the email-link helper recognizes. Latest changes: The newest commit changes the invite URL in the OAuth account-claim E2E test from
📂 Walkthrough · 12
Reviewed the commits since |
(cherry picked from commit 244d047)
(cherry picked from commit 3662450)
✨ Benchmark resultsComparing 1.9.x (before) to fix/1.9.x-security-auth (after). Before
After
Delta
Top API waits
|
…use empty keys The backported V26 filter reads the caller's scopes from the request, which 1.9 did not record. Empty secrets are refused before matching a stored key. OAuth2 unit cases changing an endpoint now send the secret, as the write-only rule requires.
Decode the HTML-escaped SMS invite link the 1.9 template sends, use the 1.9 ID helper namespace, and apply the Rector assertSame rule.
… Argon2 costs Console accounts keep account API keys in the keys collection, so claiming an unverified account through OAuth removes them as well. Imported Argon2 hashes need at least 8 KiB of memory per lane to verify.
|
@hansi-codes review |
The findings that requested changes are resolved. See the summary comment for what is still open.
The 1.9.4 project format now applies the same rule as the key routes: no secrets for JWT callers, and a calling key only sees secrets of keys its own grant covers.
|
@hansi-codes review |
…he user The OAuth callback persists the whole user document; it now does so under the user row lock and keeps an address that changed after the sign-in read the user, so a stale provider proof cannot restore the old address as verified.
|
@hansi-codes review |
The findings that requested changes are resolved. See the summary comment for what is still open.
If the account address changed after the sign-in read the user, the callback drops the identity it just linked and fails instead of issuing a session.
|
@hansi-codes review |
The findings that requested changes are resolved. See the summary comment for what is still open.
# Conflicts: # src/Appwrite/Utopia/Request.php
Argon2 needs a salt of at least 8 bytes and a tag of at least 4; shorter ones import but can never be verified at sign-in.
|
@hansi-codes review |
…tials A pending invite may have been sent to the phone the claim clears, so its secret no longer proves the account.
|
@hansi-codes review |
The findings that requested changes are resolved. See the summary comment for what is still open.
Project users have no keys attribute, so writing an empty one back made the OAuth claim fail document validation.
|
@hansi-codes review |
|
@hansi-codes review |
Backports auth, account, user and key security fixes from
mainto1.9.x. One commit per PR, plus follow-up fixes from review. No schema changes, no migrations, no new env vars.Key::findtests dropped (1.9 usesDocument::find); empty secrets refused inKey::decodePOST /v1/account/sessions/id-token) doesn't exist on 1.9Builds.php, the 1.9 equivalent ofDeployments) to the project sequenceRequestnow records the caller's scopes for the V26 filter, which also masks secrets beyond a calling key's grantimpersonatorUserIdon the user; credentials are hidden whenever it is setusers.phpusers.php; Argon2 also requires ≥ 8 KiB memory per lane, salt ≥ 8 bytes, tag ≥ 4 bytesUsersCustomServerTestkey_creation_deniedanduser_jwt_creation_denied. Get/list return secrets only withkeys.write, never to JWT callers, and to a key only when its grant covers the keyCustomchallenge doesn't exist on 1.9)_APP_JOBS_SECRETon 1.9