mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-02 08:56:07 +00:00
fix(logs): a typed username cannot forge a record in the file log
Failed logins are logged now, so S-16 applies: what a user types as a username must not break a row or forge another record. The Logs page shows each value in its own cell, escaped, and the writer cuts the username to the 150-character field (Django's login form does not stop a longer one). The file-log line written when a row cannot be saved escaped only "\n"; it now escapes "\r" too, so a CR LF in a username stays one line.
This commit is contained in:
parent
b24746c1cb
commit
291690bb20
2 changed files with 32 additions and 1 deletions
|
|
@ -24,7 +24,7 @@ def write(user, host, instance, message, success=None, ip=None):
|
|||
except Exception as e:
|
||||
try:
|
||||
line = f"audit row not saved ({e!r}): {user} {host} {instance} success={success} ip={ip} {message}"
|
||||
logger.warning(line.replace("\n", "\\n"))
|
||||
logger.warning(line.replace("\r", "\\r").replace("\n", "\\n"))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue