Skip to content

feat(logger): set diagnose=False to prevent exposing secrets in Loguru traceback logs#26814

Open
aoright wants to merge 1 commit into
open-webui:devfrom
aoright:fix-loguru-secrets-leak-dev
Open

feat(logger): set diagnose=False to prevent exposing secrets in Loguru traceback logs#26814
aoright wants to merge 1 commit into
open-webui:devfrom
aoright:fix-loguru-secrets-leak-dev

Conversation

@aoright

@aoright aoright commented Jul 6, 2026

Copy link
Copy Markdown

Pull Request Checklist

  • Target branch: The pull request targets the dev branch.
  • Description: A concise description of the changes is provided below.
  • Changelog: A changelog entry following Keep a Changelog format is included at the bottom.
  • Testing: Manual tests have been performed to verify the fix works.
  • No Unchecked AI Code: This PR is human-written or has undergone thorough human review AND manual testing.
  • Self-Review: A self-review of the code has been performed, ensuring adherence to project coding standards.
  • Title Prefix: The PR title uses the feat: prefix.

Changelog Entry

Description

Loguru traceback logs evaluate and print local variable values (by default diagnose=True), which can easily leak sensitive information (such as API keys, Bearer tokens, DB connections, or passwords) into standard stdout/JSON logs when exceptions occur in production environments.

This PR sets diagnose=False on the configured Loguru stdout, JSON, and audit log file sinks, preventing local variable evaluation while retaining the clean formatted traceback.

Fixed

  • Set diagnose=False on stdout, JSON, and audit log file sinks in logger.py.

Contributor License Agreement

…u traceback logs

Signed-off-by: 辰言 <oncwnuIWp30GguOyJ615Fqj8H-yc@git.weixin.qq.com>

@sanmaxdev sanmaxdev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Loguru enables diagnose by default, and this patch disables it on all three start_logger sinks: JSON/stdout plus audit file output.

Checked the diff against backend/open_webui/utils/logger.py and confirmed it applies cleanly.

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.

2 participants