mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-05 02:41:34 +00:00
fix: audit log records new passwords in plain text (#31622)
With request auditing turned on, the audit log only masked fields named exactly "password". The new password from a password change, and passwords entered in admin settings such as YaCy or Jupyter, were written to the log as-is. Any field whose name ends in "password", in any letter case, is now replaced with asterisks.
This commit is contained in:
parent
b4ebd0d62f
commit
d3dde3609d
1 changed files with 4 additions and 3 deletions
|
|
@ -282,11 +282,12 @@ class AuditLoggingMiddleware:
|
|||
response_body = context.response_body.decode('utf-8', errors='replace')
|
||||
|
||||
# Redact sensitive information
|
||||
if 'password' in request_body:
|
||||
if 'password' in request_body.lower():
|
||||
request_body = re.sub(
|
||||
r'"password":\s*"(.*?)"',
|
||||
'"password": "********"',
|
||||
r'"(\w*password)":\s*".*?"',
|
||||
r'"\1": "********"',
|
||||
request_body,
|
||||
flags=re.IGNORECASE,
|
||||
)
|
||||
|
||||
entry = AuditLogEntry(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue