Skip to content

Add audit logging for successful and failed user registrations in newuser function to ensure security event tracking. #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions owasp-top10-2021-apps/a9/games-irados/app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ def newuser():
hashed_psw = psw.get_hashed_password()
message, success = database.insert_user(username, hashed_psw)
if success == 1:
app.logger.info(f"New user registration successful for username: {username.decode('utf-8')}")
flash("Novo usuario adicionado!", "primary")
return redirect('/login')
else:
app.logger.warning(f"New user registration failed for username: {username.decode('utf-8')}: {message}")
flash(message, "danger")
return redirect('/register')

Expand Down