From 80e6c67beb35c520fd6289e2aab93c6b45e66b4d Mon Sep 17 00:00:00 2001 From: Jakub Date: Tue, 21 May 2024 01:01:52 +0200 Subject: [PATCH 1/2] Ensure that provided MySQL and Redis passwords are URL-Safe --- app/settings.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/settings.py b/app/settings.py index aa292197..7c91cfdb 100644 --- a/app/settings.py +++ b/app/settings.py @@ -7,6 +7,8 @@ from app.settings_utils import read_bool from app.settings_utils import read_list +from urllib.parse import quote + load_dotenv() @@ -16,14 +18,14 @@ DB_HOST = os.environ["DB_HOST"] DB_PORT = int(os.environ["DB_PORT"]) DB_USER = os.environ["DB_USER"] -DB_PASS = os.environ["DB_PASS"] +DB_PASS = quote(os.environ["DB_PASS"]) DB_NAME = os.environ["DB_NAME"] DB_DSN = f"mysql://{DB_USER}:{DB_PASS}@{DB_HOST}:{DB_PORT}/{DB_NAME}" REDIS_HOST = os.environ["REDIS_HOST"] REDIS_PORT = int(os.environ["REDIS_PORT"]) REDIS_USER = os.environ["REDIS_USER"] -REDIS_PASS = os.environ["REDIS_PASS"] +REDIS_PASS = quote(os.environ["REDIS_PASS"]) REDIS_DB = int(os.environ["REDIS_DB"]) REDIS_AUTH_STRING = f"{REDIS_USER}:{REDIS_PASS}@" if REDIS_USER and REDIS_PASS else "" From a6403bfb3a772feeb5290ac9a90278878e575029 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 23:05:35 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- app/settings.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/settings.py b/app/settings.py index 7c91cfdb..85e9bfc2 100644 --- a/app/settings.py +++ b/app/settings.py @@ -2,13 +2,12 @@ import os import tomllib +from urllib.parse import quote from dotenv import load_dotenv from app.settings_utils import read_bool from app.settings_utils import read_list -from urllib.parse import quote - load_dotenv()