PQ Python

Uvicorn

Terminates TLS with stdlib ssl, so it negotiates X25519MLKEM768 on OpenSSL 3.5+ interpreters; ssl_context_factory (0.47.0+) lets Python 3.15 require it.

PyPI
uvicorn
Version cited
0.55.0
Downloads
n/a

Key exchange and encryption

PQ with action

PQ on OpenSSL ≥3.5; 3.15 hook

Signatures and identity

PQ with action

Served ML-DSA-65 cert (tested)

What to do

Run Uvicorn on an OpenSSL 3.5+ interpreter or behind a PQ-capable proxy. On Python 3.15, use ssl_context_factory to call set_groups() and set a TLS 1.3 minimum.

Since 1 Dec 2026 Nothing found as of 3 Dec 2026.

Details

Uvicorn 0.55.0 creates a stdlib SSLContext (uvicorn config.py). It makes no group calls and has no groups CLI flag (no --ssl-groups).

Defaults and hooks#

  • ssl_ciphers calls set_ciphers(), not set_groups(), so it cannot select key exchange (ASTRA report). The AGY report notes the default is ssl_ciphers=None (#2940).
  • ssl_context_factory, added in 0.47.0 (uvicorn #2920), receives the config and a default factory and gives full Python 3.15 set_groups() control. Three variants are on the TLS and FastAPI pages (recipes, canary).
  • A string app path plus a callable factory may not work with --workers or reload; the test passed the app object.
  • Configure client-certificate verification explicitly if mTLS is intended (ASTRA report).

Test results (Claude report)#

  • X25519MLKEM768 on 3.5.7 With a self-signed P-256 certificate on PBS 3.14.6 / OpenSSL 3.5.7 and a 3.15.0 probe client.
  • With the factory requiring X25519MLKEM768 on 3.15: a 3.15 client got X25519MLKEM768 and a 3.10/OpenSSL 3.0 client was rejected with SSLEOFError.
  • Serving a self-signed ML-DSA-65 certificate on 3.15.0 (PBS, OpenSSL 3.5.9): a 3.15.0 client reported TLSv1.3 group=X25519MLKEM768 server_sigalg=mldsa65; 3.14.6 connected; 3.10.16 failed with SSLEOFError. With a P-384 certificate: server_sigalg=ecdsa_secp384r1_sha384 with X25519MLKEM768.

Header limits#

On h11, Uvicorn’s default total incomplete event size is 16 KB (--h11-max-incomplete-event-size 65536 raises it); httptools (llhttp) caps at about 80 KiB and is not CLI-tunable in Uvicorn. ML-DSA JWTs make these matter (token sizes).

fastapi[standard] pulls in uvicorn[standard]. The AGY report recommends terminating TLS at a PQ reverse proxy and raising header buffers before adopting ML-DSA JWTs.

Sources cited on this page 2
  1. uvicorn config.py github.com
  2. uvicorn #2920 github.com

All sources across the guide