Repository navigation
fix: close remaining medium issues - #14048
Conversation
Refuse the public openssl placeholder, require an installer secret, invalidate sessions and MFA challenges by default, consume recovery tokens atomically, and honor X-Forwarded-For only from trusted proxies. Co-authored-by: Jake Barnby <[email protected]>
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Keep production refuse of empty/your-secret-key. Give compose a unique non-placeholder signing key and trust loopback/RFC1918 proxies so JWT and X-Forwarded-For e2e keep working. Convert new data providers to yield. Co-authored-by: Jake Barnby <[email protected]>
…ms-2026-10-02-68be # Conflicts: # app/mqtt.php
The attribute-create worker writes status "available" before it publishes its realtime update, so the polling helper can return while that event is still in flight and land on the freshly opened socket. The delete tests then read the stale update first and the real delete event second, failing the ".delete" assertion. Drain frames until the deleting update and the delete event arrive instead of assuming they are the next two frames. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The documented default covers loopback and RFC1918 ranges, but the code fell back to an empty list when the variable was absent. Installs upgraded by bumping the image tag, without regenerating .env, would then ignore X-Forwarded-For from the bundled Traefik and see every client as the proxy address, collapsing abuse limits and session IPs into one bucket. An unset variable now uses the documented default; an explicitly empty value still trusts no hop. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sequential reuse already fails, so it does not exercise the race the transaction is meant to close. Fire several resets with the same secret at once and require exactly one to succeed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
deleteDocument locks the token row and returns false when it is already gone. The transaction ignored that result, so a reset racing another one waited on the lock, found nothing to delete and still wrote the password. Only the request that actually removes the token may change the password. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Upgrades feed the installed .env values in as defaults and disable secret generation. The token handling then blanked any value it considered insecure, so an install still on the old placeholder came out of the upgrade with an empty _APP_OPENSSL_KEY_V1 and could no longer decrypt its data. Token values are now only replaced when secrets are being generated for a fresh install. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Encrypted attributes are always written with _APP_OPENSSL_KEY_V1 and there is no rotation path, so an existing install on the public placeholder cannot switch keys without losing every encrypted value. Refusing to boot left those installs stuck after an upgrade. Production still refuses an empty key; the placeholder now logs a warning, and fresh installs never receive it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Self-review follow-ups (no Greptile review had run on this PR yet): Bugs fixed
CI
Worth a close look: the warn-vs-refuse decision in (3), and the @greptileai review |
🟢 Tier S · Ready to merge
This PR hardens signing-key generation and production startup checks, adds secret-based installer authorization, and limits forwarded IP headers to trusted proxies. It also invalidates sessions and pending MFA challenges during password changes and recovery, consumes recovery tokens transactionally, and adds regression coverage. The latest changes refine forwarded-chain handling, extend proxy defaults, restore the development key placeholder, and test administrator-initiated password changes. Latest changes: The new commits select the rightmost untrusted forwarded IP, add RFC 6598 to trusted-proxy defaults, remove the unused proxy-list emptiness method, restore the local development key placeholder, and add Users password-update invalidation coverage.
📂 Walkthrough · 26
Reviewed the commits since |
…s redirected The web installer backgrounds Server.php with stdout in a log file, so the child-printed secret never reached the operator. Generate the secret in Install.php, pass it as APPWRITE_INSTALLER_SECRET, and print the authenticated URL after the server is ready. Also pass trusted-proxy env vars into the realtime service. Co-authored-by: Jake Barnby <[email protected]>
…in libraries AGENTS.md keeps unit tests off CLI tasks and HTTP actions. The installer secret now lives in Appwrite\Installer\Secret and the keep-or-generate decision for token secrets in EncryptionKey::resolve(), both covered by library unit tests; the Install task and installer Validate action tests are removed. Co-authored-by: Jake Barnby <[email protected]>
…rd reset Password change keeps the current session but revokes others; recovery revokes every session. Both must delete the pending MFA challenge so it cannot be completed from a new session. Co-authored-by: Jake Barnby <[email protected]>
Same race as the attribute delete tests: the index-create worker can publish its "available" update after the polling helper returns, so it lands on the new socket before the delete events. Drain frames until the deleting update and the delete event arrive. Co-authored-by: Jake Barnby <[email protected]>
A session still waiting on MFA already gets 401 on /account, so that alone does not show it was revoked. List the user's sessions with the server key before and after the reset, and assert the revoked session no longer fails with user_more_factors_required. Co-authored-by: Jake Barnby <[email protected]>
abnegate
left a comment
There was a problem hiding this comment.
Reviewed the full diff at f00f0171 and checked each point below against the code (utopia-php/database 7.4.0, packages/http, the installer JS/routes). CI is green. The fixes hold up; these are the follow-ups I'd make:
Not on diff lines
-
GET /install/statusandGET /install/certificatedon't check the secret. The description says every installer request needs it, but onlyValidate/Install/Complete/Reset/ShutdowncallValidate::authorize/validateSecret./install/certificatelets any caller who can reach :20080 make the installercurl https://<domain>:<port>/withCURLOPT_RESOLVEpinned to the Docker gateway, which is a TLS port probe of the host./install/statusreturns progress for any installId (sensitive fields are stripped). The localhost-only publish limits this. Gating both is cheap becauseprogress.jsalready has the header helper (pollCertificateL343,fetchInstallStatusL425). If they should stay open, the description should say so. -
The
V26response filter still reportsauthInvalidateSessionsasfalsewhen the key is missing (src/Appwrite/Utopia/Response/Filters/V26.php:63,getAttribute('invalidateSessions', false)). This PR makes a missing key mean "invalidate" (?? true) in all four enforcement paths, andPolicies/Get/XListalready default totrue. So older-format clients would show invalidation off while it's actually on. Change the default totrue.
Nit: the new classes have several explanatory docblocks (EncryptionKey, Secret, TrustedProxies, Request::getIP, User::invalidateAuthentication) that repeat what the code says. The rationale fits better in the commit message.
| $recoveryDocument = $dbForProject->withTransaction(function () use ($dbForProject, $verifiedToken, $profile, $newPassword, $history, $passwordPwned, $proofForPassword) { | ||
| $document = $dbForProject->getDocument('tokens', $verifiedToken->getId()); | ||
| if (!$dbForProject->deleteDocument('tokens', $verifiedToken->getId())) { | ||
| throw new Exception(Exception::USER_INVALID_TOKEN); |
There was a problem hiding this comment.
Throwing the business error inside withTransaction sets off the adapter's retry loop.
Adapter::withTransaction (database 7.4.0, Adapter.php:447-491) rethrows right away only for Duplicate/Restricted/Authorization/Relationship/Conflict/Limit/Timeout. Anything else, including this Appwrite\Extend\Exception, gets rolled back and retried twice with usleep(50ms) and usleep(100ms). So every losing request in a race, and every plain token reuse, runs the SELECT … FOR UPDATE + delete 3 times and sleeps about 150ms before returning 401. The result is still correct, but a business-rule failure isn't transient and shouldn't be retried.
Have the callback signal the failure and throw after the transaction:
$recoveryDocument = $dbForProject->withTransaction(function () use (...) {
$document = $dbForProject->getDocument('tokens', $verifiedToken->getId());
if (!$dbForProject->deleteDocument('tokens', $verifiedToken->getId())) {
return null;
}
$dbForProject->updateDocument('users', ...);
return $document;
});
if ($recoveryDocument === null) {
throw new Exception(Exception::USER_INVALID_TOKEN);
}The same applies to the OTP recovery copy at L4741.
There was a problem hiding this comment.
Fixed in 7719413 for both the link and OTP recovery paths. The callback returns null when the delete loses, and USER_INVALID_TOKEN is thrown after withTransaction returns, so the adapter no longer retries it.
| return; | ||
| } | ||
|
|
||
| Console::info('Installer secret: ' . $secret); |
There was a problem hiding this comment.
If the readiness wait times out, the operator never gets the secret.
The secret and URL are only printed after waitForWebServer($port) succeeds. On the timeout branch just above, we print Web installer did not respond in time. Please refresh the browser. and return. The server may still come up, but every request will 401 because the operator has no secret, and the old Open your browser at line (printed before the wait) was removed. The secret only appears if the server log happened to be non-empty when it was dumped.
Print the secret/URL before the wait, or in the timeout branch too, so a slow start (common on Docker Desktop) is still recoverable.
There was a problem hiding this comment.
Fixed in 21a30cd. The secret and the ?secret= URL are now printed right after the server is launched, before the readiness wait, so the timeout branch still leaves the operator with both.
| [ | ||
| 'name' => '_APP_TRUSTED_PROXIES', | ||
| 'description' => 'Comma-separated CIDRs (or exact IPs) of reverse proxies that may set `_APP_TRUSTED_HEADERS` such as X-Forwarded-For. The default covers loopback and RFC1918 ranges used by Docker/Traefik. Direct clients whose connection address is not in this list are not trusted — their X-Forwarded-For is ignored. Set it to an empty value to always use the connection IP. If your load balancer has a public address, add that CIDR.', | ||
| 'introduction' => '1.8.0', |
There was a problem hiding this comment.
'introduction' => '1.8.0' is wrong for a variable added in this PR. APP_VERSION_STABLE is 2.3.0, and recently added variables use 2.3.0. Set it to the release this ships in, otherwise the generated env docs say it has existed since 1.8.
There was a problem hiding this comment.
Fixed in c0011bb: _APP_TRUSTED_PROXIES now has 'introduction' => '2.3.0'.
| return; | ||
| } | ||
|
|
||
| $challenges = $dbForProject->find('challenges', [ |
There was a problem hiding this comment.
find + Query::limit(APP_LIMIT_COUNT) + a per-document delete loop can be one bulk delete. That also drops the arbitrary cap and the no-op Query::orderAsc():
$dbForProject->deleteDocuments('challenges', [
Query::equal('userInternalId', [$sequence]),
]);deleteDocuments is in database 7.4.0 and already used in Workers/Deletes.php, and _key_user indexes userInternalId.
There was a problem hiding this comment.
Fixed in acfcde7. It's now a single deleteDocuments('challenges', [Query::equal('userInternalId', [$sequence])]), with no cap and no orderAsc.
| { | ||
| $remoteAddr = $this->getServer('remote_addr') ?? '0.0.0.0'; | ||
|
|
||
| if (!TrustedProxies::fromEnv()->contains($remoteAddr)) { |
There was a problem hiding this comment.
getIP() runs many times per request (abuse keys, audits, sessions, geo, spans), and each call re-reads the env and re-parses the CIDR list. The constructor already reads _APP_TRUSTED_HEADERS once. Build TrustedProxies there too and keep it on a private readonly property.
Naming: TrustedProxies::fromEnv sits next to Secret::fromEnvironment in this same PR. Use the full word for both, and use System::getEnv instead of raw getenv to match the rest of Request.
There was a problem hiding this comment.
Fixed in 0d6776a. TrustedProxies is built once in the Request constructor and kept on a private readonly property. fromEnv is now fromEnvironment(), with parse() for explicit values.
I kept raw getenv in fromEnvironment(), with a one-line comment. System::getEnv() is getenv($name) ?: $default, so an empty _APP_TRUSTED_PROXIES would fall back to the private-network default, but empty has to mean "trust no proxy". testEmptyEnvironmentTrustsNobody covers that case.
| if ($opensslKey === '' && !$config->isUpgrade()) { | ||
| $this->sendBadRequest($response, $swooleResponse, $wantsStream, 'Secret key is required'); | ||
| return; | ||
| if (EncryptionKey::isInsecure($opensslKey)) { |
There was a problem hiding this comment.
This block duplicates what prepareEnvironmentVariables now does. Its token loop calls EncryptionKey::resolve($value, $shouldGenerateSecrets), and here $shouldGenerateSecrets = !hasExistingConfig() && !isUpgrade(). An empty key on upgrade is already skipped by the user-input override ($value !== ''), so the existing value is kept.
Generating here also has a side effect. The random key is hashed into the progress file's opensslKeyHash. If a client resumes the same installId after sending the placeholder, it generates a different key and hits Installation payload mismatch.
Dropping the block keeps one place deciding generate-vs-keep.
There was a problem hiding this comment.
Fixed in 68c2948. The generation is gone, so prepareEnvironmentVariables is the only place that decides between generating and keeping. I kept one line, though: an insecure value is turned into '' instead of being passed through. On upgrade a placeholder sent by the client would otherwise override the installed key, because the user-input override only skips empty values. On a fresh install EncryptionKey::resolve('', true) generates the key. As a bonus, the progress-file hash is now of a stable value, so resuming the same installId no longer hits Installation payload mismatch.
withTransaction retries anything that is not a database conflict, so throwing USER_INVALID_TOKEN inside it re-ran the locked delete twice and slept about 150ms before every 401. Return null from the callback and throw once the transaction has finished. Co-authored-by: Jake Barnby <[email protected]>
Drops the APP_LIMIT_COUNT cap and the per-document loop; _key_user indexes userInternalId. Co-authored-by: Jake Barnby <[email protected]>
…lients Every enforcement path treats a missing invalidateSessions as true, and the policy endpoints already default to true. Co-authored-by: Jake Barnby <[email protected]>
… checks /install/certificate makes the installer probe a TLS port on the Docker gateway, and /install/status returns progress for any install id. The page now sends the secret header on both polls. Co-authored-by: Jake Barnby <[email protected]>
A slow start hit the timeout branch, which returned without ever showing the secret, leaving every request to 401. Co-authored-by: Jake Barnby <[email protected]>
…ion key The web installer generated its own key, duplicating EncryptionKey::resolve and hashing a fresh random value into the progress file, so resuming an install id after sending the placeholder failed with a payload mismatch. An insecure value is now sent on as empty, which never overrides the installed key and is generated only on a fresh install. Co-authored-by: Jake Barnby <[email protected]>
getIP() runs many times per request and re-read and re-parsed the environment each time. Build TrustedProxies in the constructor and rename fromEnv to fromEnvironment, with parse() for explicit values. System::getEnv() is not used because it turns an empty value into the default, and empty must trust no proxy. Co-authored-by: Jake Barnby <[email protected]>
Co-authored-by: Jake Barnby <[email protected]>
|
@abnegate thanks, all addressed:
Inline threads are answered individually. |
abnegate
left a comment
There was a problem hiding this comment.
Second round, at c0011bba. CI is green. I re-checked every first-round fix against the code, and all of them hold:
- Recovery: the callback returns
nullandUSER_INVALID_TOKENis thrown afterwithTransaction, so the adapter no longer retries. The race also holds on Mongo, whereClient::deletereturns the deleted count, so!!0isfalse. - Installer secret: printed before the readiness wait.
/install/statusand/install/certificatenow require it, and the JS sends it. The CLI'swaitForWebServer/isInstallationCompleteuse raw TCP probes, so they aren't affected. - Encryption key:
prepareEnvironmentVariablesis now the only place that decides between generating and keeping. Mapping insecure input to''keeps an installed key on upgrade, and the resume hash is now stable. - Challenges:
deleteDocuments('challenges', …)applies the same permission rule as before. Recovery addsRole::userbefore it runs, so the guest path still deletes. - Trusted proxies: parsed once per
Request. Keeping rawgetenvis right, becauseSystem::getEnvisgetenv($name) ?: $default, which would turn an explicit empty value into the default. - Smaller fixes: the
V26default and the2.3.0introduction version are fixed, and the docblocks are trimmed.
Two new inline findings below. Smaller notes:
PATCH /v1/users/:userId/passwordhas no e2e test for its new behaviour (it now deletes pending MFA challenges, and invalidates when the setting is unset). The account tests cover the sharedUser::invalidateAuthentication, but deleting the call fromUsers/Http/Users/Password/Update.phpwouldn't fail any test. A server-side counterpart oftestUpdatePasswordInvalidatesSessionsAndMFAChallengeswould close that.- Nit:
TrustedProxies::isEmpty()is only called from tests. The tests can assertcontains()instead and the method can go. - Non-blocking: consider adding
100.64.0.0/10(RFC 6598) toTrustedProxies::DEFAULT. EKS custom networking and Tailscale both put the proxy hop in that range. There, every client would show up as the ingress pod's address, so the defaulturl:{url},ip:{ip}abuse keys would be shared by all users. A public client can't arrive from that range, so it isn't any looser than the RFC1918 entries already in the list.
| _APP_EDITION=self-hosted | ||
| _APP_LOCALE=en | ||
| _APP_OPENSSL_KEY_V1=your-secret-key | ||
| _APP_OPENSSL_KEY_V1=appwrite-local-development-openssl-key |
There was a problem hiding this comment.
Changing the dev key locks contributors out of their existing local data.
users.password is stored with the encrypt filter (app/config/collections/common.php:167), and so are token secrets, identity access tokens and MFA recovery codes. The filter decrypts with _APP_OPENSSL_KEY_V1. A contributor who pulls this and recreates containers keeps their existing volumes, which were encrypted with your-secret-key. So every existing local account, including the console login, fails until they wipe volumes.
This change isn't needed any more. Since 720eed3 the placeholder only warns, and EncryptionKey::assertProduction returns early for non-production; this file sets _APP_ENV=development. main ran CI with your-secret-key, and the tests that touch the key set their own or accept any value. I'd revert this line to your-secret-key.
There was a problem hiding this comment.
Reverted in 5469f23: .env is back to _APP_OPENSSL_KEY_V1=your-secret-key. Development only gets a warning, so existing local volumes stay readable.
| return $remoteAddr; | ||
| } | ||
|
|
||
| return parent::getIP(); |
There was a problem hiding this comment.
Behind a proxy that appends, the leftmost X-Forwarded-For entry is still client-controlled.
The parent returns $ips[0] (packages/http/src/Adapter/Swoole/Request.php:75-81). That's only safe when the last hop overwrites the header, as the bundled Traefik does by default. Some proxies append instead and keep whatever the client sent at the front: nginx with $proxy_add_x_forwarded_for, Cloudflare, and Traefik once forwardedHeaders.trustedIPs is set. Behind any of those, a client sends X-Forwarded-For: 1.2.3.4, the header arrives as 1.2.3.4, <real client>, <proxy>, and getIP() returns 1.2.3.4. So the abuse-key rotation this PR closes for direct clients stays open for operators who set up their proxy chain properly.
$this->trustedProxies is everything needed to fix this here. When the connection is trusted, walk each trusted header's list right to left, skip addresses the proxy list contains, and return the first valid one that isn't trusted (the usual "rightmost untrusted" rule). Fall back to the leftmost entry when every entry is trusted. Single-value headers such as cf-connecting-ip resolve the same as today, and so do the existing e2e tests that send a single 198.51.100.x. A unit case with 'x-forwarded-for' => '1.2.3.4, 198.51.100.1, 10.0.0.3' from a trusted remote_addr should return 198.51.100.1.
There was a problem hiding this comment.
Fixed in e65a378. Once the connection is from a trusted proxy, Request::getIP() reads the valid entries of each trusted header from right to left. It returns the first entry that isn't a trusted proxy, and falls back to the leftmost entry when every entry is trusted. A header with no valid entry is skipped, and with no usable header the connection address is used. The new unit cases include your chain: 1.2.3.4, 198.51.100.1, 10.0.0.3 from a trusted remote_addr returns 198.51.100.1. Single-value headers resolve the same as before.
Existing local volumes are encrypted with it; the placeholder only warns outside production. Co-authored-by: Jake Barnby <[email protected]>
Proxies that append to X-Forwarded-For keep client-supplied entries on the left. Co-authored-by: Jake Barnby <[email protected]>
…es::isEmpty Co-authored-by: Jake Barnby <[email protected]>
…assword update Co-authored-by: Jake Barnby <[email protected]>
|
@abnegate second round addressed:
|
abnegate
left a comment
There was a problem hiding this comment.
Third round, at 3774c91f. All checks are green. Every second-round point is fixed, and I have no blocking findings.
.env: back toyour-secret-key.Request::getIP(): now takes the rightmost entry that isn't a trusted proxy. It falls back to the leftmost entry when every entry is trusted, and toremote_addrwhen no header has a valid address.$this->trustedisprotectedinpackages/http/src/Request.php:70, so overriding it is fine. The unit cases cover the appended chain, invalid entries, the all-trusted fallback and the no-valid-entry fallback.- New e2e test:
testUpdateUserPasswordInvalidatesSessionsAndMFAChallengesfails without theinvalidateAuthenticationcall: the current session would still return 200. - Smaller fixes:
isEmpty()is gone and100.64.0.0/10is in the default.
Two non-blocking notes:
-
Worth an upgrade note in the release. With the rightmost-untrusted rule, any public hop that gets recorded in the forwarding header now has to be listed in
_APP_TRUSTED_PROXIES. Two common setups put one there:- Cloudflare in front of a Traefik with
forwardedHeaders.trustedIPsset. Traefik appends the Cloudflare edge address after the client. - GCP's external Application Load Balancer, which appends
<client-ip>,<load-balancer-ip>.
Before this PR those setups got the real client from the leftmost entry. After upgrading, every client resolves to the edge or load-balancer address and shares the
url:{url},ip:{ip}abuse buckets until the operator adds those ranges, or switches_APP_TRUSTED_HEADERSto a header the edge overwrites, such ascf-connecting-ip. The variable description covers this, but operators usually only notice through 429s, so a line in the release notes would help. - Cloudflare in front of a Traefik with
-
Optional:
testUpdateUserPasswordInvalidatesSessionsAndMFAChallengestests a Users server route fromAccountCustomClientTest. AGENTS.md puts it undertests/e2e/Services/Users/(UsersCustomServerTest), and the Users CI job won't run it where it is. Moving it means movingcreateFreshAccountWithSession/createPendingMFAChallenge/listUserSessionIdsinto a shared trait, so leaving it is a fair call.
|
@abnegate thanks.
|
What does this PR do?
Closes the remaining verified Medium Help Scout issues on CE
main(4f07216c). One reviewable security PR covering default signing keys, installer auth, session invalidation, recovery-token reuse, and X-Forwarded-For trust.Fixes in this PR
your-secret-key(EncryptionKey::resolve()). Upgrades keep the existing key, since a new one would make encrypted data unreadable. The web installer passes the placeholder on as empty, so the same rule decides there and a placeholder can never overwrite an installed key. Production HTTP/worker/realtime/mqtt refuse to start when_APP_OPENSSL_KEY_V1is empty and warn when it is still the placeholder.variables.phpdefault is empty (install generates). The repo.envkeepsyour-secret-key(development only warns), so existing local volumes stay readable.Appwrite\Installer\Secret) inx-appwrite-installer-secret. That covers validate, install, complete, reset and shutdown, which also check CSRF, plus thestatusandcertificateGET polls. Only the page itself is served without it. Theinstall/upgradetask generates the secret, passes it to the background server asAPPWRITE_INSTALLER_SECRET(the server's STDOUT goes to a log file), and printshttp://localhost:20080/?secret=…in the foreground right after launching the server, so a slow start that misses the readiness wait still shows it. The page keeps the secret insessionStorageand sends it on each request. RunningServer.phpdirectly still prints its own secret. README publishes127.0.0.1:20080:20080.invalidateSessions ?? trueon password change, recovery confirmation, recovery OTP, and Users password update (matches new-project / policy defaults, and the 1.xV26response filter now reports it the same way). When invalidating, outstanding MFAchallengesare deleted so a pending 2FA cannot be completed._APP_TRUSTED_PROXIESCIDR list. Trusted IP headers are honored only whenremote_addris in that list. Unset defaults to loopback + RFC1918 + RFC 6598 (Docker/Traefik/Kubernetes). Behind a trusted proxy the client IP is the rightmost header entry that is not itself a trusted proxy, so a spoofed leftmost entry is ignored even when the proxy appends. Direct public clients are not in that list, so they cannot rotate XFF. An empty value trusts nobody. Passed to bothappwriteandappwrite-realtime(the only services that buildAppwrite\Utopia\Request).Upgrade note (for the release notes)
The client IP is now the rightmost
X-Forwarded-Forentry that is not in_APP_TRUSTED_PROXIES. Setups that record a public hop in the forwarding header must list it, or switch_APP_TRUSTED_HEADERSto a header the edge overwrites. Otherwise every client resolves to that hop's address and shares the IP-based abuse buckets (429s). Common cases:forwardedHeaders.trustedIPsset: add the Cloudflare IP ranges to_APP_TRUSTED_PROXIES, or set_APP_TRUSTED_HEADERS=cf-connecting-ip.<client-ip>,<load-balancer-ip>): add the load balancer's address or range to_APP_TRUSTED_PROXIES.Help Scout verdicts
NON_ISSUELEGIT_FIXED_IN_PRLEGIT_FIXED_IN_PRNON_ISSUELEGIT_FIXED_IN_PRLEGIT_FIXED_IN_PRFIXED_ALREADY(#14028)LEGIT_FIXED_IN_PRLEGIT_FIXED_IN_PRFIXED_ALREADY(#14028)NON_ISSUELEGIT_FIXED_IN_PRLEGIT_FIXED_IN_PRLEGIT_FIXED_IN_PRFIXED_ALREADYwebhook SSRF / TOCTOU work is #14028 — not duplicated here. Residual Destination policy remains #13998.Test Plan
Unit tests (local
src/Appwritelibraries only, per AGENTS.md):tests/unit/Auth/EncryptionKeyTest.php— placeholder / empty detection, production warn vs refuse,resolve()generates on fresh install and keeps existing keys on upgradetests/unit/Installer/SecretTest.php— constant-time match, nothing issued never matches, secret handed over viaAPPWRITE_INSTALLER_SECRET, generated otherwisetests/unit/Network/TrustedProxiesTest.php— CIDR / empty-list / unset defaulttests/unit/Utopia/RequestTest.php—getIP()ignores client XFF unless the connection is a trusted proxy, and takes the rightmost untrusted hop of an appended chainE2E (
tests/e2e/Services/Account/AccountCustomClientTest.php):testUpdateAccountRecovery/testUpdateAccountRecoveryConcurrently— recovery token cannot be reused, and only one of 8 concurrent resets succeedstestUpdatePasswordInvalidatesSessionsAndMFAChallenges— current session kept, other sessions revoked, pending MFA challenge rejectedtestUpdateRecoveryInvalidatesSessionsAndMFAChallenges— all sessions revoked, pending MFA challenge rejectedtestUpdateUserPasswordInvalidatesSessionsAndMFAChallenges— server-sidePATCH /v1/users/:userId/passwordrevokes all sessions and rejects the pending MFA challengeRelated PRs and Issues
Checklist