Jump to solution
Details

The Fix

pip install urllib3==1.26.9

Based on closed urllib3/urllib3 issue #2192 · PR/commit linked

Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.

Open PR/Commit
@@ -40,6 +40,10 @@ jobs: experimental: false nox-session: test-pypy + - python-version: "pypy-3.8" + os: ubuntu-latest + experimental: false
fix.md
Option A — Upgrade to fixed release\npip install urllib3==1.26.9\nWhen NOT to use: Do not use this fix if your application relies on the previous behavior of ignoring commonName checks.\n\nOption C — Workaround\nfor previous OpenSSL versions, https://bugs.python.org/issue43522.\nWhen NOT to use: Do not use this fix if your application relies on the previous behavior of ignoring commonName checks.\n\n

Why This Fix Works in Production

  • Trigger: Respect SSLContext.hostname_checks_common_name set manually by users
  • Mechanism: Respects the SSLContext.hostname_checks_common_name setting, allowing users to enforce commonName checks.
  • Why the fix works: Respects the SSLContext.hostname_checks_common_name setting, allowing users to enforce commonName checks. (first fixed release: 1.26.9).
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • Triggered by an upgrade/regression window: 3.8.9–3.9.3 breaks; 1.26.9 is the first fixed release.
  • Shows up under Python 3.8.9 in real deployments (not just unit tests).
  • Production symptom (often without a traceback): Respect SSLContext.hostname_checks_common_name set manually by users

Proof / Evidence

  • GitHub issue: #2192
  • Fix PR: https://github.com/urllib3/urllib3/pull/2518
  • First fixed release: 1.26.9
  • Affected versions: 3.8.9–3.9.3
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.95
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.74

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“The issue is now fixed in OpenSSL and Python has a workaround for previous OpenSSL versions, https://bugs.python.org/issue43522”
@tiran · 2021-04-17 · confirmation · source
“Adding Breaking Change label solely for being considered a blocker of v2.0”
@sethmlarson · 2021-03-21 · source

Failure Signature (Search String)

  • Respect SSLContext.hostname_checks_common_name set manually by users
  • If a user sets `SSLContext.hostname_checks_common_name` we should respect their request and check commonName. This provides a fallback we can point to in case users rely on
Copy-friendly signature
signature.txt
Failure Signature ----------------- Respect SSLContext.hostname_checks_common_name set manually by users If a user sets `SSLContext.hostname_checks_common_name` we should respect their request and check commonName. This provides a fallback we can point to in case users rely on commonName support.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Respect SSLContext.hostname_checks_common_name set manually by users If a user sets `SSLContext.hostname_checks_common_name` we should respect their request and check commonName. This provides a fallback we can point to in case users rely on commonName support.

Environment

  • Python: 3.8.9

What Broke

Users experienced SSL certificate verification failures due to ignored commonName checks.

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install urllib3==1.26.9

When NOT to use: Do not use this fix if your application relies on the previous behavior of ignoring commonName checks.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Option C — Workaround Temporary workaround

for previous OpenSSL versions, https://bugs.python.org/issue43522.

When NOT to use: Do not use this fix if your application relies on the previous behavior of ignoring commonName checks.

Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.

Fix reference: https://github.com/urllib3/urllib3/pull/2518

First fixed release: 1.26.9

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use this fix if your application relies on the previous behavior of ignoring commonName checks.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.
  • Add a TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
  • Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.

Version Compatibility Table

VersionStatus
3.8.9 Broken
3.9.3 Broken
1.26.9 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.