The Fix
Addresses the issue with wildcard certificates by implementing a more complex IDNA handling mechanism.
Based on closed urllib3/urllib3 issue #979 · 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%.
@@ -1,9 +1,13 @@
@@ -1,9 +1,13 @@
+# -*- coding: utf-8 -*-
+import unittest
+
Option A — Apply the official fix\nAddresses the issue with wildcard certificates by implementing a more complex IDNA handling mechanism.\nWhen NOT to use: This fix should not be used if the application does not handle wildcard certificates.\n\n
Why This Fix Works in Production
- Trigger: Usage of cryptography + idna breaks on wildcard certs
- Mechanism: The IDNA handling mechanism was too simplistic for wildcard certificates
- 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
- Shows up under Python 2.7 in real deployments (not just unit tests).
- The IDNA handling mechanism was too simplistic for wildcard certificates
- Production symptom (often without a traceback): Usage of cryptography + idna breaks on wildcard certs
Proof / Evidence
- GitHub issue: #979
- Fix PR: https://github.com/urllib3/urllib3/pull/980
- Reproduced locally: No (not executed)
- Last verified: 2026-02-11
- Confidence: 0.70
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.80
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Ok fab, I'll give that a shot and see if it helps.”
“Okay, I understand this bug now”
“So we're using idna basically because cryptography does. @reaperhulk, any insight here?”
“Besides that idna was a terrible mistake? I need to know what version of cryptography. I was just able to load the cert in question…”
Failure Signature (Search String)
- Usage of cryptography + idna breaks on wildcard certs
- The changes in #930 seem to have broken with some wildcard certificates:
Copy-friendly signature
Failure Signature
-----------------
Usage of cryptography + idna breaks on wildcard certs
The changes in #930 seem to have broken with some wildcard certificates: https://stackoverflow.com/questions/39521147/why-is-urllib3-idna-complaining-about-a-wildcard-in-an-x509-cert-how-do-i-fix-i
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Usage of cryptography + idna breaks on wildcard certs
The changes in #930 seem to have broken with some wildcard certificates: https://stackoverflow.com/questions/39521147/why-is-urllib3-idna-complaining-about-a-wildcard-in-an-x509-cert-how-do-i-fix-i
Environment
- Python: 2.7
- urllib3: 1.7
What Broke
Wildcards in certificates caused failures in certificate validation leading to connection issues.
Why It Broke
The IDNA handling mechanism was too simplistic for wildcard certificates
Fix Options (Details)
Option A — Apply the official fix
Addresses the issue with wildcard certificates by implementing a more complex IDNA handling mechanism.
Fix reference: https://github.com/urllib3/urllib3/pull/980
Last verified: 2026-02-11. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the application does not handle wildcard certificates.
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.
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.