feat: replace advocate with champion and upgrade urllib3 to 2.x#7721
feat: replace advocate with champion and upgrade urllib3 to 2.x#7721wtfiwtz wants to merge 2 commits into
Conversation
Replace the deprecated advocate library with champion (modern fork) as an optional install group, enabling urllib3 to be upgraded to 2.x. Changes: - Remove advocate from core dependencies - urllib3: 1.26.19 → 2.7.0 - Add optional [tool.poetry.group.ssrf] with champion pinned to git rev 74cf301 - Change ENFORCE_PRIVATE_ADDRESS_BLOCK default from true → false - SSRF protection now requires explicit opt-in + champion install Code changes: - Replace requests_or_advocate with requests_or_champion throughout - Conditional champion import with helpful error message when unavailable - Update imports in query_runner/__init__.py, csv.py, excel.py - Update settings/__init__.py with new default and documentation SSRF protection is now an opt-in feature: - Set REDASH_ENFORCE_PRIVATE_IP_BLOCK=true - Install with: poetry install --with ssrf - Or: pip install git+https://github.com/Gee19/champion.git Co-authored-by: Cursor <cursoragent@cursor.com>
CVE / advisory coverage for PR #7721 (
|
| Package | Version change | CVEs / advisories addressed |
|---|---|---|
| urllib3 | 1.26.19 → 2.7.0 | Multiple advisories fixed between 1.26.x and 2.x, including CVE-2023-43804 (cookie header injection), CVE-2024-37891 (proxy-authorization header leakage on redirect), and subsequent 2.x-line fixes through 2.7.0 |
SSRF protection change (security-relevant, not a CVE ID fix)
| Change | Notes |
|---|---|
| Remove advocate from core deps | Unmaintained library removed |
Add optional [tool.poetry.group.ssrf] with champion (git rev 74cf301) |
Modern fork of advocate for private-IP blocking |
ENFORCE_PRIVATE_ADDRESS_BLOCK default: true → false |
SSRF blocking is now opt-in — set REDASH_ENFORCE_PRIVATE_IP_BLOCK=true and install with poetry install --with ssrf |
Rename requests_or_advocate → requests_or_champion |
Code paths in requests_session.py, HTTP/CSV/Excel query runners |
This addresses Redash’s historical URL-loading data source SSRF class of risk (CVE-2021-43780 context), but the champion swap itself is a maintainability + urllib3 2 compatibility change rather than a mapped CVE remediation.
Transitive all_ds bumps (required for poetry lock with urllib3 2.x)
| Package | Version change | Why |
|---|---|---|
| boto3 / botocore | 1.28.8 / 1.31.8 → 1.43.7 | botocore 1.31.x pins urllib3 <1.27 |
| requests | 2.32.3 → 2.33.0 | Aligns with updated AWS stack |
| azure-core, grpcio, h11, httpcore, marshmallow | Added minimum pins | Transitive constraints from boto3 upgrade |
snowflake-connector-python remains at 3.12.3 (compatible with urllib3 2.x on Python 3.13 without forcing the larger 4.x bump).
Other changes in this PR (not CVE fixes)
| Change | Notes |
|---|---|
core-js ^2.6.12 |
Webpack/babel build fix for @babel/preset-env polyfill resolution under pnpm |
poetry.lock regeneration |
Resolves urllib3 2.x solver conflicts |
tests/query_runner/test_http.py |
Update imports from requests_or_advocate to requests_or_champion |
Behavior change to be aware of
Default SSRF protection is now off. Deployments that relied on advocate being always installed with blocking enabled by default must explicitly:
- Set
REDASH_ENFORCE_PRIVATE_IP_BLOCK=true - Install champion:
poetry install --with ssrf(or addssrfto Dockerfileinstall_groups)
Out of scope for this PR
| Area | Handled in |
|---|---|
| Werkzeug 3, authlib 1.7, Jinja2, PyJWT, cryptography, Flask bumps | #7719 / #7722 |
| Frontend npm CVEs | #7720 |
| Debian OS / Docker base image CVEs | #7718 |
| jwcrypto 1.5.7 (CVE-2026-39373) | Not in any split branch yet |
| paramiko (CVE-2026-44405) | Blocked by sshtunnel compatibility |
There was a problem hiding this comment.
2 issues found across 10 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="redash/query_runner/excel.py">
<violation number="1" location="redash/query_runner/excel.py:60">
P1: Potential SSRF regression in Excel query runner: default deployments no longer block private/internal addresses</violation>
</file>
<file name="pyproject.toml">
<violation number="1" location="pyproject.toml:162">
P1: SSRF protection dependency moved to optional Poetry group, removing secure-by-default SSRF blocking</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| try: | ||
| response = requests_or_advocate.get(url=path, headers={"User-agent": ua}) | ||
| response = requests_or_champion.get(url=path, headers={"User-agent": ua}) |
There was a problem hiding this comment.
P1: Potential SSRF regression in Excel query runner: default deployments no longer block private/internal addresses
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At redash/query_runner/excel.py, line 60:
<comment>Potential SSRF regression in Excel query runner: default deployments no longer block private/internal addresses</comment>
<file context>
@@ -57,7 +57,7 @@ def run_query(self, query, user):
try:
- response = requests_or_advocate.get(url=path, headers={"User-agent": ua})
+ response = requests_or_champion.get(url=path, headers={"User-agent": ua})
workbook = pd.read_excel(response.content, **args)
</file context>
| # Optional SSRF protection (enables REDASH_ENFORCE_PRIVATE_IP_BLOCK). | ||
| # Install via `poetry install --with ssrf` or add `ssrf` to the install_groups | ||
| # build arg in the Dockerfile. | ||
| [tool.poetry.group.ssrf] |
There was a problem hiding this comment.
P1: SSRF protection dependency moved to optional Poetry group, removing secure-by-default SSRF blocking
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At pyproject.toml, line 162:
<comment>SSRF protection dependency moved to optional Poetry group, removing secure-by-default SSRF blocking</comment>
<file context>
@@ -152,6 +156,17 @@ optional = true
+# Optional SSRF protection (enables REDASH_ENFORCE_PRIVATE_IP_BLOCK).
+# Install via `poetry install --with ssrf` or add `ssrf` to the install_groups
+# build arg in the Dockerfile.
+[tool.poetry.group.ssrf]
+optional = true
+
</file context>
Replace the deprecated advocate library with champion (modern fork) as an optional install group, enabling urllib3 to be upgraded to 2.x.
Changes:
Code changes:
SSRF protection is now an opt-in feature:
What type of PR is this?
Description
How is this tested?
Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings (if there are UI changes)