Skip to content

fix: prevent secrets in Loguru tracebacks - #25769

Closed
RealBhupesh wants to merge 1 commit into
open-webui:devfrom
RealBhupesh:codex/fix-loguru-secret-tracebacks
Closed

RealBhupesh wants to merge 1 commit into
open-webui:devfrom
RealBhupesh:codex/fix-loguru-secret-tracebacks

Conversation

@RealBhupesh

Copy link
Copy Markdown

Pull Request Checklist

  • Linked Issue/Discussion: Fixes feat: Don't show secrets in Loguru stack traces in logs #25767
  • Target branch: This pull request targets the dev branch.
  • Description: A concise description is provided below.
  • Changelog: A changelog entry is included below.
  • Documentation: No documentation changes are required for this logging security fix.
  • Dependencies: No dependencies were added or updated.
  • Testing: An automated regression test verifies traceback context remains while frame values are hidden.
  • No Unchecked AI Code: Please complete after human review and manual testing.
  • Self-Review: The diff was reviewed for scope and repository style.
  • Architecture: This uses Loguru's supported sink configuration without adding settings.
  • Git Hygiene: The PR is atomic and based on dev.
  • Title Prefix: The title uses the fix prefix.

Description

Loguru text sinks default to diagnose=True, which renders values from exception frames. Request objects can contain sensitive headers such as API keys, causing secrets to appear in stack traces regardless of the configured log level.

This change disables diagnostic variable rendering for the human-readable stdout sink while retaining traceback function and exception context. It also adds a regression test using a simulated API key.

Validation

  • python3 -m pytest -q test/test_logger.py
  • python3 -m py_compile backend/open_webui/utils/logger.py test/test_logger.py
  • python3 -m ruff format --check backend/open_webui/utils/logger.py test/test_logger.py
  • Targeted Ruff checks pass; the existing logger file has unrelated pre-existing E501 and E731 findings.

Changelog Entry

Security

  • Prevent exception tracebacks from exposing local variable values, including secrets in request headers.

Fixed

  • Preserve useful traceback context without Loguru diagnostic value rendering.

Additional Information

Fixes #25767

Screenshots or Videos

  • Not applicable.

Contributor License Agreement

@owui-terminator

Copy link
Copy Markdown

Notice regarding Contributor License Agreement acceptance

@RealBhupesh

The Contributor License Agreement (CLA) checkbox in the pull request description remains unchecked (- [ ]).

Explicit acceptance of the CLA is required for the acceptance of any contribution. By leaving the checkbox unmarked, the agreement to the terms has not been legally confirmed.

This pull request has been closed. To resolve this matter, please edit the pull request description to explicitly check the CLA checkbox (- [x]), or submit a new pull request.

@owui-terminator owui-terminator Bot closed this Jun 6, 2026
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