ShardBrowser icon indicating copy to clipboard operation
ShardBrowser copied to clipboard

[BUG] Authenticated proxy usernames containing commas fail with ERR_INVALID_AUTH_CREDENTIALS

Open ZeNou opened this issue 2 months ago • 3 comments

Description

When using an authenticated HTTP proxy with ShardBrowser, authentication fails if the proxy username contains commas.

Some proxy providers encode targeting or session parameters in the username. A generic example is:

demo,parameter1,parameter2

The same proxy credentials work correctly outside ShardBrowser.

All endpoints and credentials in this issue are illustrative placeholders.

Example

Using the proxy directly through ShardBrowser:

async with sdk.session(
    profile,
    proxy="http://demo%2Cparameter1%2Cparameter2:[email protected]:8080"
) as browser:
    ...

results in Chromium returning:

ERR_INVALID_AUTH_CREDENTIALS

What I found

I tested the authentication behavior with both plain and comma-containing usernames.

Results:

  • Plain username using inline proxy authentication → works
  • Username containing commas using inline proxy authentication → fails
  • Same comma-containing username/password supplied separately through the browser context → works
  • Same credentials tested independently against the proxy → works

Based on these results, I suspect the encoded commas (%2C) may be passed through literally rather than decoded back to , before proxy authentication. I have not confirmed the exact username received by the proxy.

For example, authentication may be attempted with:

demo%2Cparameter1%2Cparameter2

instead of:

demo,parameter1,parameter2

Workaround

I was able to make the proxy work by launching the browser and passing the proxy authentication separately through Patchright:

context = await browser.new_context(
    proxy={
        "server": "http://proxy.example.com:8080",
        "username": "demo,parameter1,parameter2",
        "password": "password",
    }
)

This works correctly and preserves the commas in the username.

However, this bypasses ShardBrowser's normal sdk.session(..., proxy=...) path. I'm unsure whether this affects any geo/fingerprint, timezone, WebRTC, or QUIC configuration that might depend on the launch proxy.

Expected behavior

ShardBrowser should support authenticated proxy usernames containing URL-encoded special characters, including commas.

For example:

proxy="http://demo%2Cparameter1%2Cparameter2:[email protected]:8080"

should authenticate using the decoded username:

demo,parameter1,parameter2

Environment

  • ShardBrowser / ShardX Python SDK
  • Docker
  • HTTP authenticated proxy
  • Chromium error: ERR_INVALID_AUTH_CREDENTIALS

Happy to provide a minimal reproduction or additional logs if useful.

ZeNou avatar Sep 17 '26 14:09 ZeNou

Same thing on the desktop Launcher. I think I found where the encoding comes from.

Environment: ShardX Launcher 2.0.3 (engine 152.0.7977.65), Windows 11 build 26200. Residential proxy whose username carries geo-targeting parameters, e.g. <id>__cr.fr,be (placeholder).

Repro: temporary profile via POST /profiles/temporary with an inline proxy, then POST /profiles/{id}/start and open https://ipinfo.io/json.

Proxy string Result
socks5://<id>__cr.fr,be:<pass>@<host>:<port> ERR_SOCKS_CONNECTION_FAILED
http://<id>__cr.fr,be:<pass>@<host>:<port> ERR_TUNNEL_CONNECTION_FAILED
same two with the comma pre-encoded as %2C same errors
socks5://<id>__cr.fr:<pass>@<host>:<port> (no comma) works
http://<id>__cr.fr:<pass>@<host>:<port> (no comma) works

The comma credentials work with curl -x socks5h://… and curl -x http://… from the same machine.

Likely cause: ProxyEntry::to_proxy_server_arg serializes the username and password with url::form_urlencoded::byte_serialize before building --proxy-server=…:

https://github.com/ProxyShard/ShardBrowser/blob/4880c3fd1a6360bc205daa5bc5542b16277201c3/src-tauri/src/proxy.rs#L38-L56

Both launch paths use it (launch.rs#L224, runner.rs#L1444), so , becomes %2C. The engine doesn't seem to percent-decode the userinfo from --proxy-server, so the proxy gets …cr.fr%2Cbe literally. That matches what @ZeNou suspected above. I only tested inline proxies; stored proxies go through the same function, so I'd expect the same result.

Possible fix: percent-decode the userinfo in the engine before it answers the SOCKS5 / HTTP auth challenge. Escaping fewer characters on the launcher side wouldn't be enough, because passwords containing :, @ or % still need encoding. Also, form_urlencoded turns spaces into +, which isn't percent-encoding in URL userinfo.

Workaround for now: keep a single targeting value in the username (e.g. one country per proxy list), so nothing needs escaping.

Nbparts avatar Sep 21 '26 10:09 Nbparts

I am also struggling with the same problem. ShardX is the only browser that worked for my use case against Akamai among the free ones. Everything was perfect.... until I started implementing proxies. My entire project is unable to continue just because of the commas in my proxy username. Thanks a lot for this project, and I hope you patch this bug soon @ProxyShard @Kr1tos

Coding-Doctor-Omar avatar Oct 04 '26 11:10 Coding-Doctor-Omar

in 2.1.0

Kr1tos avatar Oct 22 '26 11:10 Kr1tos