Skip to content

url: Keep the query when a broker URL is sanitized - #2704

Open
SashaMIT wants to merge 4 commits into
celery:mainfrom
SashaMIT:fix/sanitize-url-query
Open

SashaMIT wants to merge 4 commits into
celery:mainfrom
SashaMIT:fix/sanitize-url-query

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 1, 2026 •

Copy link
Copy Markdown

Summary

  • sanitize_url("http://u:p@e.com/foo?a=1") returned http://u:**@e.com/foo. as_url accepted the parsed query and then left it out, so masking the password also dropped every parameter.
  • The query is written back out. http://u:p@e.com//foo still masks the password and still has no query. amqp://user:pass@localhost:5672/my/vhost is unchanged.

Test plan

  • On tip, test_sanitize_url_keeps_query failed: http://u:**@e.com/foo against http://u:**@e.com/foo?a=1.
  • After the fix, pytest t/unit/utils/test_url.py passed (20).

sanitize_url dropped ?a=1 while masking the password.

@auvipy auvipy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

any relevant issue you are fixing with this?

@auvipy auvipy added this to the 5.7.x milestone Oct 5, 2026
@SashaMIT

SashaMIT commented Oct 6, 2026

Copy link
Copy Markdown
Author

There is no filed issue. sanitize_url of http://u:p@e.com/foo?a=1 came back as http://u:**@e.com/foo. Masking the password dropped the query. The query is written back out. A URL with no query is unchanged.

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