Proxy credentials in the proxy URL are not percent-decoded
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 74/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- networking
Direzione di ricerca
Inizia dal punto di ingresso parse_proxy() in websockets.proxy e segui il percorso delle sue credenziali fino a connect_socks_proxy() e connect_http_proxy(). Verifica l’URL di riproduzione con una password codificata in percentuale, quindi conferma che entrambi i percorsi del proxy ricevano i valori decodificati di nome utente e password e che i test del proxy esistenti abbiano esito positivo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
parse_proxy() takes username and password from urllib.parse.urlparse(...) as they are, without percent-decoding them. A password that contains a reserved character has to be percent-encoded to be representable in the URL at all (socks5://alice:p%40ss@host:1080 for the password p@ss), but websockets then sends the literal string p%40ss to the proxy: connect_socks_proxy() hands proxy.username / proxy.password to python-socks unchanged, and connect_http_proxy() base64-encodes them unchanged for Proxy-Authorization.
python-socks itself (python_socks._helpers.parse_proxy_url) applies unquote() to both, so the same URL works with python-socks directly and with other clients that build on it, but not through websockets' proxy= parameter. RFC 3986 section 3.2.1 defines userinfo as percent-encoded.
Reproduction
>>> from websockets.proxy import parse_proxy
>>> p = parse_proxy("socks5://alice:p%40ss@127.0.0.1:1080")
>>> p.password
'p%40ss'
Against a SOCKS5 proxy with user/password auth the connection is rejected (ProxyError: failed to connect to SOCKS proxy), against an HTTP CONNECT proxy with basic auth it is answered with 407.
Environment
websockets 16.0, Python 3.13.5, python-socks 3.1.1, Linux x86_64.
Expected
parse_proxy() percent-decodes username and password (e.g. urllib.parse.unquote), like python-socks and requests do for proxy URLs, so that credentials with @, :, / or % can be used.
- Lingua principale
- Python
- Stelle
- 5.7k
- Fork
- 613
- Merge medio
- 23h 5m
- PR unite (30g)
- 9
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di python-websockets/websockets
-
Ping/pong frame logging can produce text that crashes non-UTF-8 log handlers (UnicodeEncodeError) Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
python-websockets/websockets#1763 · 9 commenti ·
-
documentation
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
python-websockets/websockets#1756 · 2 commenti ·
Tutte le issue di python-websockets/websockets
Issue simili
-
triage/confirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
apache/cloudstack#14222 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100