Skip to content

fix: decode percent-encoded password in parseRedisUrl - #1952

Closed
heavenly999 wants to merge 1 commit into
docmost:mainfrom
SYMAR-AI:fix/redis-url-password-decode
Closed

heavenly999 wants to merge 1 commit into
docmost:mainfrom
SYMAR-AI:fix/redis-url-password-decode

Conversation

@heavenly999

Copy link
Copy Markdown

Problem

parseRedisUrl() returns the password from new URL().password without decoding it. The WHATWG URL spec mandates that = is percent-encoded as %3D in the userinfo section.

Cloud Redis providers (Azure Managed Redis, AWS ElastiCache, etc.) use base64 access keys that end with =. When these keys are placed in a redis:// URL, the parser encodes them:

redis://:aBjR684eranIt5Ch13YS7aoUFioc4N5CpAzCaJdAF4g=@host:6379
                                                     ^
                                          URL parser encodes this to %3D

url.password then returns ...4N5CpAzCaJdAF4g%3D, which ioredis sends verbatim to Redis AUTH → WRONGPASS.

Verified in Node.js:

const u = new URL('redis://:key=@host:6379');
u.password // => 'key%3D'  (not 'key=')

Fix

Add decodeURIComponent() to the parsed password before returning RedisConfig. This is safe for passwords that don't contain percent-encoded characters (decoding a string without %XX sequences is a no-op).

Testing

Tested against Azure Managed Redis with a base64 access key ending in =. Before fix: WRONGPASS. After fix: connects successfully.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

The WHATWG URL parser percent-encodes '=' as '%3D' in the userinfo
section of URLs. Cloud Redis providers like Azure and AWS use base64
access keys that contain '='. Without decoding, ioredis sends the
percent-encoded password to Redis AUTH, which rejects it with
WRONGPASS.

This adds decodeURIComponent() to the parsed password before
returning the RedisConfig.
@heavenly999
heavenly999 force-pushed the fix/redis-url-password-decode branch from 747cab9 to 8ce5b2a Compare February 17, 2026 07:55
@Philipinho

Copy link
Copy Markdown
Member

If you don't mind, can you finish the CLA step so I can review?

@heavenly999

Copy link
Copy Markdown
Author

@Philipinho hey, yes, I did that already but nothing happened. I clicked on the link, logged in with my Github account, redirected back to Github, but the badge didn't change. Tried the recheck button as well.

Page says I agreed already:
image

Yundi339 added a commit to Yundi339/docmost that referenced this pull request Apr 22, 2026
- parseRedisUrl now decodeURIComponent-s the password so URLs with
  percent-encoded specials (e.g. '%40' for '@') connect correctly.
- Missing port falls back to 6379 instead of NaN.
- rediss:// URLs now set tls: {} which is threaded through to the four
  ioredis consumers (collab, queue, nestjs-ioredis, throttler).

Cherry-picked from upstream docmost#1952 and docmost#2021.
@Philipinho Philipinho closed this Nov 10, 2026
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.

4 participants