Repository navigation
fix(redis): honour _APP_REDIS_USER and pass credentials to the queue publisher - #13622
Merged
Merged
Conversation
…publisher Every Redis client authenticated with the password alone, so an ACL user configured through _APP_REDIS_USER was ignored and logins failed with WRONGPASS, and the queue publisher was built with host and port only, so a password-protected Redis rejected every publish with NOAUTH. Authenticate with the [user, password] pair when a user is set, hand the DSN credentials to the queue connection, and percent-encode credentials when building the fallback DSNs so passwords containing URL delimiters parse.
loks0n
approved these changes
Sep 11, 2026
Contributor
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
…user named 0 URL::unparse() also re-assembles parse_url() output in resolveLocation(), whose parts are already percent-encoded, so encoding inside unparse() double-encoded them. Encode the raw environment values where the fallback DSNs are built instead. Compare user and password against the empty string explicitly so a valid ACL username such as 0 is not dropped by PHP truthiness.
resolveLocation() feeds parse_url() parts back into unparse(), and those are already percent-encoded, so encoding inside unparse() double-encoded them. Credentials are encoded where the raw environment values enter the fallback DSNs instead.
This was referenced Sep 11, 2026
This was referenced Sep 11, 2026
Closed
pull Bot
pushed a commit
to AmirulAndalib/appwrite
that referenced
this pull request
Sep 11, 2026
2.2.3 authenticates the queue Redis connection with the user and password Appwrite now passes from the DSN (appwrite#13622), so publishers and consumers work against a password-protected or ACL-secured Redis.
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Self-hosted installs with an external Redis that requires a user and password cannot log in. Three separate gaps, all reproduced against a Redis with
requirepassplus an ACL user and thedefaultuser disabled:_APP_REDIS_USERwas read but never used. The pooled Redis resource inapp/init/registers.php, therediscontainer resource inapp/init/resources.phpandgetRedis()inapp/realtime.phpall calledauth($pass). That works forrequirepassbut an ACL user fails withWRONGPASS. They now callauth([$user, $pass])when a user is set.registers.phpbuiltQueue\Connection\Rediswith host and port only, so every publish (and, throughapp/worker.php, every consume) failed withNOAUTHon any password-protected Redis (Publisher pool cannot authenticate to password-protected Redis (NOAUTH in task-scheduler) — credentials dropped in registers.php and never used by utopia-php/queue #13554). The DSN user and password are now passed through. Same change as fix(queue): pass Redis DSN credentials to the publisher pool #13588.URL::unparse()did not percent-encode user or password, whileUtopia\DSNurldecode()s them, so a password containing@ : / ? #failed at boot withUnable to parse DSN.unparse()nowrawurlencode()s both.registers.phpis its only caller, so nothing else changes.The publisher half depends on
utopia-php/queueactually callingauth(), which utopia-php/monorepo#260 adds. Until that is released and bumped here, cache, pubsub, lock and realtime authenticate correctly with this PR and the publisher still reportsNOAUTH. The bump will be added to this PR once the tag exists.Test Plan
Probe from inside the
appwritecontainer against a Redis withrequirepass secretpwandACL SETUSER appwrite on >userpw ~* &* +@all, before this change:Then the stack (
appwrite,appwrite-worker,appwrite-realtime,appwrite-task-scheduler) recreated with_APP_REDIS_HOST=redis-acl _APP_REDIS_USER=appwrite _APP_REDIS_PASS=userpwand thedefaultuser disabled, with this change applied:NOAUTH/WRONGPASSin the API or realtime logs.CLIENT LISTon the Redis shows the API, cache, pubsub, lock and realtime connections asuser=appwrite(hget,hset,get,evalsha,subscribe).Unit:
tests/unit/URL/URLTest.phppasses.composer lintand PHPStan clean on the changed files.Related PRs and Issues
Checklist
utopia-php/queueonce Better json error response #260 is tagged