Skip to content

Refresh changed OpenSSL CA sources without repeating path setup - #247

Open
notatallshaw wants to merge 1 commit into
sethmlarson:mainfrom
notatallshaw:fix/refresh-openssl-ca-sources
Open

notatallshaw wants to merge 1 commit into
sethmlarson:mainfrom
notatallshaw:fix/refresh-openssl-ca-sources

Conversation

@notatallshaw

@notatallshaw notatallshaw commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Track Linux/OpenSSL CA sources on each internal SSL context so repeated connections avoid registering unchanged verification paths.

The crux is a typed source snapshot attached to each internal SSLContext and guarded by its existing lock.

  • Unchanged sources: metadata checks only.
  • Changed CA file or CRL: reload the file only.
  • Changed directory or source selection: run default setup once.
  • Missing source or failed load: retry on the next wrap.

On OpenSSL 3.0, automatic setup adds no directory lookups after the first wrap. N handshakes then perform N or 2N opens, depending on whether defaults were preloaded, instead of O(N²).

I validated long-lived contexts in pip, conda, Safety, Firebolt, instawow, OSMO, and Roboto, plus their urllib3, HTTPX, aiohttp, and urllib paths. Every case verified an initial root and a same-metadata replacement while directory opens stayed fixed per handshake.

The implementation follows OpenSSL's default-path contract and preserves Python's documented CA-file, CRL, and lazy capath behavior. Prior art includes OpenSSL 3.4's duplicate-search fix, libcurl's bounded CA cache, and Unix snapshots in Go and rustls.

Supersedes #213, #244, and #246.

This branch has not been deployed

No deployments
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