Skip to content

fix(logging): mask the broker password in startup logs - #39

Merged
langesven merged 1 commit into
mainfrom
sl/mask-broker-url-in-logs
Nov 12, 2026
Merged

langesven merged 1 commit into
mainfrom
sl/mask-broker-url-in-logs

Conversation

@langesven

Copy link
Copy Markdown
Contributor

Problem

Phlower logs the full CELERY_BROKER_URL at startup, both in the app lifespan and when the event consumer starts. Against a broker that requires AUTH, the URL carries the password (rediss://:<password>@host:6379), so the password ends up in the logs.

Changes

  • Both log lines pass the URL through kombu.utils.url.maybe_sanitize_url, the same helper Celery uses for its worker banner. The password shows as **.
  • Phlower still connects with the full URL. Only the logged string changes.

Testing

  • uv run pytest -q passes.
  • maybe_sanitize_url("rediss://:s3cret@host:6379?ssl_cert_reqs=required") returns rediss://:**@host:6379/.

🤖 Generated with Claude Code

The startup log lines printed the full broker URL, which includes the
password when the broker requires AUTH.
@langesven
langesven marked this pull request as ready for review November 12, 2026 18:17
@langesven
langesven merged commit 90bec03 into main Nov 12, 2026
12 checks passed
@langesven
langesven deleted the sl/mask-broker-url-in-logs branch November 12, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant