Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork4.9k
Prevents issue #9921, Add URL validation to Celery class initialization, and update docs#9973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull Request Overview
This PR adds broker URL validation to catch malformed URLs early with helpful error messages. The validation is performed during Celery app initialization and provides guidance to users about proper URL encoding.
- Validates broker URLs at app initialization using kombu's
parse_urlfunction - Provides clear error messages when special characters are not properly percent-encoded
- Documents the requirement for percent-encoding special characters in credentials
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| celery/app/base.py | Adds_validate_broker_url() method and calls it during__init__ to validate broker URLs early |
| docs/userguide/configuration.rst | Adds warning section documenting the requirement to percent-encode special characters in broker URLs |
| t/unit/app/test_app.py | Adds three test cases covering invalid URLs, properly encoded URLs, and None broker URLs |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
codecovbot commentedOct 29, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #9973 +/- ##==========================================- Coverage 78.68% 78.68% -0.01%========================================== Files 153 153 Lines 19313 19322 +9 Branches 2214 2215 +1 ==========================================+ Hits 15197 15204 +7- Misses 3817 3819 +2 Partials 299 299
Flags with carried forward coverage won't be shown.Click here to find out more. ☔ View full report in Codecov by Sentry. |
lichfiet commentedOct 29, 2025
@auvipy changes were made, thanks for letting me contribute. Let me know if you see anything else needing updated. |
Uh oh!
There was an error while loading.Please reload this page.
| ..warning:: | ||
| Special characters in usernames and passwords must be percent-encoded. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
To be clear, this is not a Celery specific issue, it's true for all URIs. Some parsers may tolerate a subset of special characters in the userinfo, but everything except for unreserved (ALPHA / DIGIT / "-" / "." / "_" / "~") and sub-delim ("!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=") ought to be percent encoded.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Implement copilot suggestions to make the error less verbose. The fact that the host should be valid is implicit.Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Include docs suggestion for the before, to give users a better visualization of the encodingCo-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Isabelle COWAN-BERGMAN <Izzette@users.noreply.github.com>
Description
This pull request aims to help with the issue encountered in issue#9921, which uses Kombu's URL parser to pre-parse the URL when initializing the main Celery class.