Skip to content

login#10

Merged
beackers merged 2 commits intomainfrom
login
Dec 11, 2025
Merged

login#10
beackers merged 2 commits intomainfrom
login

Conversation

@beackers
Copy link
Owner

No description provided.

password check is there, but don't know if it works
log.info("user logged in!")
return redirect("/", code=301)
else:
log.warning(f"someone failed a login!\nusername: {u["username"]}\npassword: {u["password"]}")

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (password)
as clear text.
This expression logs
sensitive data (password)
as clear text.
This expression logs
sensitive data (password)
as clear text.
This expression logs
sensitive data (password)
as clear text.

Copilot Autofix

AI 3 months ago

General fix:
To fix the problem, the logging code at line 192 should be modified to exclude the password from the log entry. Instead, it can log only non-sensitive information such as the username and a generic failure message. Alternatively, if more detailed context is desired (without logging sensitive data), information such as the user's IP address, timestamp, or the nature of the failure can be logged—but never the password itself.

Specific fix for this code:
Edit line 192 in app.py so that the log entry does not include u["password"]. Only the username (if you wish to keep that) and a message about the failed login should be logged. The change should be within the login route, affecting only the logging call.

Required changes:

  • Edit only the relevant log statement (line 192) to remove the password from the log message.

Suggested changeset 1
app.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/app.py b/app.py
--- a/app.py
+++ b/app.py
@@ -189,7 +189,7 @@
                 log.info("user logged in!")
                 return redirect("/", code=301)
             else:
-                log.warning(f"someone failed a login!\nusername: {u["username"]}\npassword: {u["password"]}")
+                log.warning(f"someone failed a login!\nusername: {u['username']}")
                 abort(403)
     elif request.method == "DELETE":
         session["user"] = None
EOF
@@ -189,7 +189,7 @@
log.info("user logged in!")
return redirect("/", code=301)
else:
log.warning(f"someone failed a login!\nusername: {u["username"]}\npassword: {u["password"]}")
log.warning(f"someone failed a login!\nusername: {u['username']}")
abort(403)
elif request.method == "DELETE":
session["user"] = None
Copilot is powered by AI and may make mistakes. Always verify output.
@beackers beackers merged commit eb96ba0 into main Dec 11, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant