Skip to content

[rust] Switch reqwest TLS backend from aws-lc-rs to ring#17589

Open
AutomatedTester wants to merge 2 commits into
trunkfrom
worktree-macos-ring-crypto
Open

[rust] Switch reqwest TLS backend from aws-lc-rs to ring#17589
AutomatedTester wants to merge 2 commits into
trunkfrom
worktree-macos-ring-crypto

Conversation

@AutomatedTester
Copy link
Copy Markdown
Member

Summary

  • Switches reqwest from the rustls feature to rustls-no-provider, eliminating the aws-lc-rsaws-lc-sys dependency chain
  • Adds a direct rustls dependency with the ring feature so ring is the only compiled crypto provider
  • Installs ring as the process-default TLS provider at startup in main.rs
  • Cargo.lock: aws-lc-rs and aws-lc-sys are fully removed

Why

aws-lc-sys is a C library that needs compiler-rt builtins and system frameworks (e.g. CoreServices on macOS) at compile time. These are not available in the hermetic LLVM sysroot that the cross-compilation PR (#17586) registers for macOS. Switching to ring (pure Rust + lightweight C, no external system deps) unblocks registering the hermetic LLVM exec toolchain on macOS for fully reproducible builds.

ring is already in the dependency graph (pulled in by quinn), so no net-new crate is introduced — we're just removing one crypto backend and making the other explicit.

Test plan

  • Rust / Tests (ubuntu) passes (existing coverage)
  • Rust / Tests (macos) passes — this is the regression that motivated the change
  • Rust / Tests (windows) passes
  • Selenium Manager can make HTTPS requests at runtime (TLS provider initialised before first use)

The default reqwest `rustls` feature pulls in aws-lc-rs → aws-lc-sys, a C
library that requires compiler-rt builtins and system frameworks (e.g.
CoreServices on macOS) that are not available in the hermetic LLVM sysroot.
The `ring` crate is pure Rust + lightweight C with no external system library
dependencies, making it compatible with hermetic build toolchains.

Changes:
- reqwest: switch feature from `rustls` to `rustls-no-provider`, which wires
  up the full rustls stack (including rustls-platform-verifier for cert
  verification) but does not force any crypto backend.
- Add direct `rustls` dependency with `ring` feature so ring is the only
  crypto provider compiled into the binary.
- Install ring as the process-default TLS provider at the start of main()
  (required when using `rustls-no-provider`; rustls 0.23 needs an explicit
  provider before ClientConfig::builder() is called).
- Cargo.lock: aws-lc-rs and aws-lc-sys are removed; ring and its lightweight
  deps remain.
@selenium-ci selenium-ci added C-rust Rust code is mostly Selenium Manager B-manager Selenium Manager labels May 29, 2026
Installing the provider only in main() meant unit tests (which never
call main) would panic when creating an HTTP client. Moving the install
into create_http_client — the single entry point for all reqwest Client
construction — ensures the provider is present in every code path
including tests. install_default() returns Err if already installed,
so the let _ = pattern makes repeated calls safe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-manager Selenium Manager C-rust Rust code is mostly Selenium Manager

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants