-
Notifications
You must be signed in to change notification settings - Fork 11
fix(pygluu-containerlib): passing reserved @ in SQL #507
Copy link
Copy link
Open
Milestone
Description
The issue is located in the engine_url property of the SQLClient class.
The code is using a f-string to manually build a connection URI. Since @ is a reserved character in URLs (used to separate the credentials from the host), having an @ in the password confuses the parser. It thinks the password ends at the first @ it encounters, making the rest of the password look like the hostname.
Mainly this part:
gluu4/pygluu-containerlib/pygluu/containerlib/persistence/sql.py
Lines 63 to 66 in 2fd72d5
| database = os.environ.get("GLUU_SQL_DB_NAME", "gluu") | |
| user = os.environ.get("GLUU_SQL_DB_USER", "gluu") | |
| password = get_sql_password() | |
| return f"{self.adapter.connector}://{user}:{password}@{host}:{port}/{database}" |
I think we should simply use
from urllib.parse import quote_plus
and URL encode it
password = quote_plus(get_sql_password())
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels