Skip to content

feat: replace advocate with champion and upgrade urllib3 to 2.x#7721

Open
wtfiwtz wants to merge 2 commits into
getredash:masterfrom
orchestrated-io:fix/urllib3-2x-champion-ssrf
Open

feat: replace advocate with champion and upgrade urllib3 to 2.x#7721
wtfiwtz wants to merge 2 commits into
getredash:masterfrom
orchestrated-io:fix/urllib3-2x-champion-ssrf

Conversation

@wtfiwtz

@wtfiwtz wtfiwtz commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

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:

What type of PR is this?

  • Refactor
  • Feature
  • Bug Fix
  • New Query Runner (Data Source)
  • New Alert Destination
  • Other

Description

How is this tested?

  • Unit tests (pytest, jest)
  • E2E Tests (Cypress)
  • Manually
  • N/A

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

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>
@wtfiwtz
wtfiwtz marked this pull request as ready for review June 1, 2026 07:40
@wtfiwtz

wtfiwtz commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Disclaimer: This comment was AI-generated to summarize the CVE and advisory coverage for this PR. Please verify against your scanner output and release notes before treating it as authoritative.

CVE / advisory coverage for PR #7721 (fix/urllib3-2x-champion-ssrf)

This PR replaces deprecated advocate with optional champion SSRF protection and upgrades urllib3 to 2.x. It does not include the broader Python security bumps from #7719 (Werkzeug 3, authlib 1.7, cryptography 48, etc.).

Primary dependency fix

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: truefalse SSRF blocking is now opt-in — set REDASH_ENFORCE_PRIVATE_IP_BLOCK=true and install with poetry install --with ssrf
Rename requests_or_advocaterequests_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:

  1. Set REDASH_ENFORCE_PRIVATE_IP_BLOCK=true
  2. Install champion: poetry install --with ssrf (or add ssrf to Dockerfile install_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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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>

Comment thread pyproject.toml
# 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]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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>

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