Skip to content

Commit 7b8c8f4

Browse files
committed
fix: use raw string for docstring with backslashes
- Change docstring to r" \\ format in sanitize_for_logging function
1 parent 30914c5 commit 7b8c8f4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/api/auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@
5353

5454

5555
def sanitize_for_logging(text):
56-
"""
56+
r"""
5757
Remove control characters from user input before logging to prevent log injection.
5858
5959
Security Issue #9120: User-provided data like emails can contain newlines, carriage
6060
returns, or tabs that allow attackers to inject false log entries, corrupt log files,
6161
bypass log analysis tools, or hide malicious activity.
6262
63-
Example Attack: email="user@test.com\\nFAKE: Admin login successful from 1.2.3.4"
63+
Example Attack: email="user@test.com\nFAKE: Admin login successful from 1.2.3.4"
6464
6565
Args:
6666
text (str): User-provided input to sanitize
6767
6868
Returns:
69-
str: Text with control characters (\\n, \\r, \\t) removed
69+
str: Text with control characters (\n, \r, \t) removed
7070
"""
7171
if not text:
7272
return text

0 commit comments

Comments
 (0)