Skip to content

Commit a04cc65

Browse files
sqlalchemy: Properly escape passwords into the db_uri.
1 parent 89c9f06 commit a04cc65

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

omniduct/databases/sqlalchemy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import absolute_import
22

3+
import urllib
4+
35
from interface_meta import override
46

57
from omniduct.utils.debug import logger
@@ -62,7 +64,8 @@ def db_uri(self):
6264
# pylint: disable-next=consider-using-f-string
6365
return "{dialect}://{login}@{host_port}/{database}".format(
6466
dialect=self.dialect + (f"+{self.driver}" if self.driver else ""),
65-
login=self.username + (f":{self.password}" if self.password else ""),
67+
login=self.username
68+
+ (f":{urllib.parse.quote_plus(self.password)}" if self.password else ""),
6669
host_port=self.host + (f":{self.port}" if self.port else ""),
6770
database=self.database,
6871
)

0 commit comments

Comments
 (0)