Skip to content

Add cacert_file= and deprecate bundled CA certificates on MRI - #484

Open
yyuu wants to merge 7 commits into
nahi:masterfrom
yyuu:use-openssl-trust-store-by-default
Open

yyuu wants to merge 7 commits into
nahi:masterfrom
yyuu:use-openssl-trust-store-by-default

Conversation

@yyuu

@yyuu yyuu commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Keep the bundled CA certificates as the default CA file on MRI until HTTPClient 3.0.0.
  • Warn once per process when the bundled CA file is loaded. The notice says that MRI will use OpenSSL::X509::DEFAULT_CERT_FILE starting with HTTPClient 3.0.0 and shows how to opt in.
  • Add SSLConfig#cacert_file= to select a CA file. Assigning it replaces the store and resets sessions. If loading fails, the previous configuration is kept.
  • JRuby keeps its runtime trust store by default. An explicit load_trust_ca still works there.
  • Mark the 3.0.0 default change with TODO(3.0.0) comments.

Notes for reviewers

  • The 3.0.0 default change and the notice text are not final. Please confirm them before merging.
  • test/test_ssl.rb contains ENV.delete('NIX_SSL_CERT_FILE') as a workaround for local Nix environments. It does not affect CI and is kept for now.

Related to #480.

@yyuu
yyuu marked this pull request as ready for review October 30, 2026 07:48
@yyuu
yyuu marked this pull request as draft November 2, 2026 01:56
@yyuu
yyuu marked this pull request as ready for review November 2, 2026 03:33
…#480)

Until HTTPClient 3.0.0, MRI keeps using the bundled CA certificates by
default. Loading them emits a deprecation notice once per process that
points to OpenSSL::X509::DEFAULT_CERT_FILE as an opt-in replacement.

- Add SSLConfig#cacert_file= to select a CA file. Assigning it replaces
  the certificate store and resets sessions. If loading fails, the
  previous file and store are kept.
- Keep JRuby's runtime trust store as the default. An explicit
  load_trust_ca still adds the selected file, including the bundled one.
- Cover the notice, file selection, and store replacement with tests.
- Mark the 3.0.0 default change with TODO(3.0.0) comments.
@yyuu yyuu changed the title Use OpenSSL's default CA file on MRI Add cacert_file= and deprecate bundled CA certificates on MRI Nov 16, 2026
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