summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/plugin
diff options
context:
space:
mode:
authorYassen Damyanov <yd@itlabs.bg>2022-09-22 12:12:28 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2022-09-23 17:27:30 -0400
commit3333c6623fa45bcbc7fabd061184a79b7b7f2fa6 (patch)
tree6c262c52683c544470d68a0ae40c5c0ed16b1722 /lib/sqlalchemy/testing/plugin
parentd50bbd56740f86bb363b405f7d8e5df9667bb4e3 (diff)
downloadsqlalchemy-3333c6623fa45bcbc7fabd061184a79b7b7f2fa6.tar.gz
Tighten password security by removing `URL.__str__`
For improved security, the :class:`_url.URL` object will now use password obfuscation by default when ``str(url)`` is called. To stringify a URL with cleartext password, the :meth:`_url.URL.render_as_string` may be used, passing the :paramref:`_url.URL.render_as_string.hide_password` parameter as ``False``. Thanks to our contributors for this pull request. Fixes: #8567 Closes: #8563 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8563 Pull-request-sha: d1f1127f753849eb70b8d6cc64badf34e1b9219b Change-Id: If756c8073ff99ac83876d9833c8fe1d7c76211f9
Diffstat (limited to 'lib/sqlalchemy/testing/plugin')
-rw-r--r--lib/sqlalchemy/testing/plugin/plugin_base.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py
index 494e7d5ab..b90a2ec58 100644
--- a/lib/sqlalchemy/testing/plugin/plugin_base.py
+++ b/lib/sqlalchemy/testing/plugin/plugin_base.py
@@ -436,7 +436,10 @@ def _engine_uri(options, file_config):
if options.write_idents and provision.FOLLOWER_IDENT:
with open(options.write_idents, "a") as file_:
- file_.write(provision.FOLLOWER_IDENT + " " + db_url + "\n")
+ file_.write(
+ f"{provision.FOLLOWER_IDENT} "
+ f"{db_url.render_as_string(hide_password=False)}\n"
+ )
cfg = provision.setup_config(
db_url, options, file_config, provision.FOLLOWER_IDENT