Skip to content

fix(pygluu-containerlib): passing reserved @ in SQL #507

@moabu

Description

@moabu

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:

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())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions