Repository navigation
feat(http): make the rustls crypto backend a feature - #2317
Merged
Merged
Conversation
http_client took rustls with `ring` hard-coded, so every consumer of bashkit pinned `ring` for its whole dependency graph. Downstream trees that also link aws-lc-rs ended up shipping two C/assembly crypto libraries (~800 KiB and two CVE/FIPS stories in the everruns CLI). The backend is now selected by feature: `ring` (default, unchanged behavior) or `aws-lc-rs`. `http_client` no longer implies a backend; `ring` wins when both are enabled, so Cargo's additive unification can never leave two providers racing for the default slot, and building `http_client` with neither is a compile_error! instead of a panic at the first TLS handshake. `ring` stays the default because it keeps the tree free of C-compiled crypto, which is what keeps cross-compiled aarch64 manylinux wheel builds green. Consumers on --no-default-features must now name a backend alongside http_client; in-tree, bashkit-cli names `ring` and bashkit-eval names it on its own direct rustls dep. Provider install and its regression tests are cfg'd per backend and pass under both the default set and `--no-default-features --features http_client,aws-lc-rs`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Embedders can now choose which crypto backend bashkit's rustls HTTP client uses,
instead of inheriting
ringunconditionally:ring— the default, behavior identical to todayaws-lc-rs— for consumers who need a FIPS-capable backend, or who alreadylink aws-lc-rs elsewhere and don't want two crypto libraries in one binary
http_clientno longer implies a backend.ringwins when both features areenabled, so Cargo's additive unification can never leave two providers racing
for the default slot. Building
http_clientwith neither backend is acompile_error!rather than a panic at the first TLS handshake.Compatibility: additive.
default = ["bash_tool", "ring"], so existingconsumers see the same provider and the same dependency tree. Consumers on
default-features = falsemust now name a backend alongsidehttp_client;in-tree,
bashkit-clinamesringandbashkit-evalnames it on its owndirect
rustlsdep.Why
Because the backend was pinned in the dependency itself, a single crate
selecting
rustls/ringpinnedringfor its entire graph. Downstream treesthat also link aws-lc-rs ended up shipping both — roughly 800 KiB (~5.8%) of the
release
everrunsCLI in duplicated AES-GCM and P-256 code, plus two C/assemblycrypto libraries to track CVEs against, two FIPS stories, and a
CryptoProviderambiguity each embedder had to resolve by hand.
bashkit had already done the hard part: it takes reqwest with
rustls-no-providerand installs the provider itself. Only the choice washard-coded, so this is a small change with real downstream leverage.
ringstays the default deliberately — it keeps the tree free of C-compiledcrypto, which is what keeps cross-compiled aarch64 manylinux wheel builds green
(
aws-lc-systrips over the missingAT_HWCAP2in that cross sysroot).This does not on its own remove
ringfrom the everruns graph —ureq(viarakers) pins it too and needs a separate upstream fix. This is the first andmost tractable step.
Before / After
Selecting a backend actually changes the tree. Before, no combination of
features could drop
ring. After:The default set is unchanged —
aws-lc-sysis still absent, exactly as before:A missing backend fails at build time, not at the first handshake:
Both backends install a provider correctly (
network::clientsuite, whichincludes the provider-install regression and idempotency tests):
ring)--no-default-features --features http_client,aws-lc-rsRisk
default-features = false+http_clientwith no backend named — and that fails loudly at compile timewith a message naming the fix, rather than silently changing TLS behavior.
--all-featuresclippy/doc jobs now compileaws-lc-sys(builds cleanlocally; adds a few minutes to those two jobs). No new packages enter
Cargo.lock— aws-lc-rs was already there with cargo-vet exemptions, socargo deny/cargo vetare unaffected.Checklist