forked from brian7704/OpenTAKServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Problem
The AMQP URL construction in multiple files does not URL-encode the username and password:
rmq_url = f"amqp://{rmq_user}:{rmq_pass}@{rmq_host}:{rmq_port}/{rmq_vhost}"If a password contains special characters like @, /, :, or #, the URL will be malformed and connection will fail.
Example
# Password with special characters
rmq_pass = "p@ss/word:123"
# Current (broken):
amqp://user:p@ss/word:123@localhost:5672/ # Parsing fails
# Fixed:
amqp://user:p%40ss%2Fword%3A123@localhost:5672/ # Works correctlySolution
Use urllib.parse.quote() to encode credentials:
from urllib.parse import quote
rmq_url = f"amqp://{quote(rmq_user, safe='')}:{quote(rmq_pass, safe='')}@{rmq_host}:{rmq_port}/{rmq_vhost}"Files Affected
opentakserver/app.pyopentakserver/cot_parser/cot_parser.pyopentakserver/eud_handler/client_controller.py
Related
Identified during code review of PR #1