Skip to content

Default ssl_ciphers to None and use OpenSSL defaults#2940

Merged
Kludex merged 2 commits into
mainfrom
safer-default-ssl-ciphers
May 19, 2026
Merged

Default ssl_ciphers to None and use OpenSSL defaults#2940
Kludex merged 2 commits into
mainfrom
safer-default-ssl-ciphers

Conversation

@Kludex
Copy link
Copy Markdown
Owner

@Kludex Kludex commented May 19, 2026

Summary

  • Change the default of ssl_ciphers (Config, run(), and --ssl-ciphers) from "TLSv1" to None.
  • When None, create_ssl_context() already skips ctx.set_ciphers(...), so OpenSSL's current safe defaults apply.
  • Update the docs entry in docs/settings.md to match.

The previous "TLSv1" value is an OpenSSL cipher string (not a protocol selector) that resolves to every cipher available in TLS 1.0 - an outdated baseline that doesn't track modern best practice. Letting OpenSSL pick its defaults keeps the cipher list current as the library evolves, without uvicorn freezing a string in place.

Test plan

  • uv run pytest tests/test_ssl.py tests/test_config.py tests/test_main.py - 143 passed
  • uv run ruff check uvicorn && uv run ruff format --check uvicorn
  • uv run mypy uvicorn
  • CI green

AI Disclaimer

This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.

The previous default 'TLSv1' is an OpenSSL cipher string that resolves
to all ciphers available in TLS 1.0, an outdated baseline. Defaulting
to None skips set_ciphers() and lets OpenSSL apply its current safe
defaults, which track best practice as the library evolves.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

📖 Docs preview: https://4bf98090.uvicorn.pages.dev

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 19, 2026

Merging this PR will not alter performance

✅ 24 untouched benchmarks


Comparing safer-default-ssl-ciphers (7d1e155) with main (479a2c0)

Open in CodSpeed

@Kludex Kludex changed the title Default ssl_ciphers to None and use OpenSSL defaults Default ssl_ciphers to None and use OpenSSL defaults May 19, 2026
After defaulting ssl_ciphers to None, no existing test exercised the
ctx.set_ciphers() path. Add a focused test that passes ssl_ciphers
explicitly to keep that branch covered at 100%.
@Kludex Kludex merged commit abe0781 into main May 19, 2026
24 checks passed
@Kludex Kludex deleted the safer-default-ssl-ciphers branch May 19, 2026 12:18
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