Skip to content

Commit 2844f1e

Browse files
Merge pull request #4 from devwithkrishna/hotfix/loginjection-issue
If unsanitized user input is written to a log entry, a malicious user…
2 parents 6ee1fd2 + f09d61f commit 2844f1e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/quickapi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ async def create_item(item: UserColorEntry):
4040
"""Create an item with a username and users favourite colour and return it."""
4141
user_colour.append(item)
4242
print(user_colour)
43-
logger.info(item)
43+
# Sanitize log message to prevent log injection
44+
logger.info("New user-color entry added: username=%s, color=%s", item.username, item.color)
4445
return item
4546

4647
# List all user_colour mappings

0 commit comments

Comments
 (0)