File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 5353
5454
5555def 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
You can’t perform that action at this time.
0 commit comments