Skip to content

fix(deps): Bump idna to 3.20 to fix a DoS from crafted DSN hosts - #148

Merged
armenzg merged 1 commit into
mainfrom
fix/deps-idna-dos
Nov 6, 2026
Merged

armenzg merged 1 commit into
mainfrom
fix/deps-idna-dos

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Category: vulnerable runtime dependency. I found no open application security issue that isn't already covered. The one candidate left, an org-controlled DSN host that the app POSTs to (SSRF), is already proposed in #89.

Vulnerability. uv.lock pins idna 3.6, which requests and urllib3 pull in. That version has quadratic-time idna.encode() on crafted non-ASCII hostnames: CVE-2024-3651, and the incomplete fix tracked as CVE-2026-45409 / GHSA-65pc-fj4g-8rjx, fixed in 3.15.

How the app reaches it. The DSN comes from the installing org's own .sentry/sentry_config.ini. GithubClient accepts any host that sentry_sdk.utils.Dsn parses. Then requests.post(self.sentry_project_url) in _send_envelope runs urllib3/requests URL normalization, which calls idna.encode() on a non-ASCII host. The config is cached, but each workflow_job webhook builds and posts a new envelope, so the cost comes back on every job.

Severity: medium (availability). Measured locally with the locked dependencies, preparing the envelope POST for a DSN host of N "\u0660" characters took:

  • idna 3.6: N=4,000 → 1.2 s, N=16,000 → 18.8 s, N=32,000 → 78 s of CPU
  • idna 3.20: under 0.01 s for every size (rejected as InvalidURL)

The image runs one gunicorn worker with 4 threads and --timeout 0, so a stuck request never gets killed. One org with a large job matrix could keep the instance's CPU and threads busy, and every other installation's webhooks would be delayed or dropped. Cloud Run would also scale out on the load. The attacker needs to install the GitHub App and push a .sentry repo. My inference that third parties can do this rests on two observations: https://github.com/apps/sentry-github-app-alpha returns 200 without logging in, and production events show envelopes going to non-Sentry DSN hosts. Event f950db04e5d44c739338508b09c01e09 (SENTRY-GITHUB-ACTIONS-APP-8B, 2026-11-05) is a connect timeout to an arbitrary third-party host taken from an org's DSN. I found no sign that anyone has exploited this.

Fix. uv lock --upgrade-package idna (3.6 → 3.20). No code changes. The Docker image installs with --locked, so the patched version ships with the next image.

Verification.

  • Re-ran the timing reproduction above against the updated lock.
  • uv run pytest: 84 passed. uv run mypy: clean. uv run pre-commit run --all-files: passed.
  • pip-audit on the exported production requirements no longer reports idna. It still reports flask (session Vary: Cookie; the app doesn't use sessions), jinja2 (the app doesn't render templates), and werkzeug (safe_join on Windows; the app runs on Linux and doesn't serve files). None of these are reachable here, so this PR leaves them alone.

via automation sched_2663accc24a4cb8adfb43de4543ec71e · Run ID sched_2663accc24a4cb8adfb43de4543ec71e:1793968200000.

--

View Session [Sentry]

@sentry-junior
sentry-junior Bot requested a review from a team as a code owner November 6, 2026 12:39
@armenzg
armenzg merged commit 6ba34d7 into main Nov 6, 2026
17 checks passed
@armenzg
armenzg deleted the fix/deps-idna-dos branch November 6, 2026 13:29
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