Merge pull request #72 from PhoenixTwoFive/71-fix-code-scanning-alert-clear-text-logging-of-sensitive-information

Remove Logging
This commit is contained in:
Phillip Kühne
2023-10-03 19:51:06 +02:00
committed by GitHub

View File

@ -130,7 +130,7 @@ def get_song_completions(input_string):
stmt = text( stmt = text(
""" """
SELECT CONCAT(Artist, ' - ', Title) AS Song, Id FROM songs SELECT CONCAT(Artist, ' - ', Title) AS Song, Id FROM songs
WHERE MATCH(Artist, Title) WHERE MATCH(Artist, Title)
AGAINST (:prepared_string IN NATURAL LANGUAGE MODE) AGAINST (:prepared_string IN NATURAL LANGUAGE MODE)
LIMIT 20; LIMIT 20;
""") """)
@ -144,7 +144,7 @@ def get_songs_with_details(input_string: str):
prepared_string = f"%{input_string}" prepared_string = f"%{input_string}"
stmt = text( stmt = text(
""" """
SELECT Id, Title, Artist, Year, Duo, Explicit, Styles, Languages FROM songs SELECT Id, Title, Artist, Year, Duo, Explicit, Styles, Languages FROM songs
WHERE MATCH(Artist, Title) WHERE MATCH(Artist, Title)
AGAINST (:prepared_string IN NATURAL LANGUAGE MODE) AGAINST (:prepared_string IN NATURAL LANGUAGE MODE)
LIMIT 20; LIMIT 20;
@ -154,11 +154,12 @@ def get_songs_with_details(input_string: str):
stmt, {"prepared_string": prepared_string}) stmt, {"prepared_string": prepared_string})
return cur.fetchall() return cur.fetchall()
def get_song_details(song_id: int): def get_song_details(song_id: int):
with get_db_engine().connect() as conn: with get_db_engine().connect() as conn:
stmt = text( stmt = text(
""" """
SELECT Id, Title, Artist, Year, Duo, Explicit, Styles, Languages FROM songs SELECT Id, Title, Artist, Year, Duo, Explicit, Styles, Languages FROM songs
WHERE Id = :song_id; WHERE Id = :song_id;
""" """
) )
@ -166,6 +167,7 @@ def get_song_details(song_id: int):
stmt, {"song_id": song_id}) stmt, {"song_id": song_id})
return cur.fetchall() return cur.fetchall()
def add_entry(name, song_id, client_id): def add_entry(name, song_id, client_id):
with get_db_engine().connect() as conn: with get_db_engine().connect() as conn:
stmt = text( stmt = text(
@ -285,7 +287,6 @@ def get_config(key: str) -> str:
def set_config(key: str, value: str) -> bool: def set_config(key: str, value: str) -> bool:
print(f"Setting config {key} to {value}")
with get_db_engine().connect() as conn: with get_db_engine().connect() as conn:
conn.execute(text( conn.execute(text(
"INSERT INTO config (`Key`, `Value`) VALUES ( :par_key , :par_value) ON DUPLICATE KEY UPDATE `Value`= :par_value"), "INSERT INTO config (`Key`, `Value`) VALUES ( :par_key , :par_value) ON DUPLICATE KEY UPDATE `Value`= :par_value"),