tls: default to Arti's rustls backend (drop OpenSSL from TLS) #100

Merged
sirius merged 2 commits from wt/t_17e3d3cf-rustls-default into main 2026-09-18 01:20:36 +00:00
Owner

Closes the hardening note "rustls default": the root crate no longer selects Arti's native-tls (OpenSSL) backend by default.

Change

  • Cargo.toml: default = ["rustls"] (was ["native-tls"]), still exposed as an opt-in feature; the crate's TLS default is now the same as the Android SDK's.
  • Cargo.toml: new direct rustls = { version = "0.23", default-features = false, features = ["ring"] }. This is load-bearing, not cosmetic: tor-rtcompat pulls rustls in with default-features = false, and rustls 0.23 resolves its provider from its OWN ring/aws-lc-rs features — without this pin the backend compiles with zero providers and the first TLS config fails. Same pin and reasoning as crates/onionwire-sdk/Cargo.toml.
  • tests/tls_backend.rs (new): a compile-time assertion that the default feature set selects rustls and not native-tls (the target stops compiling if default moves back), plus a runtime check that building a rustls::ClientConfig the way Arti does resolves a CryptoProvider with no manual install.
  • .forgejo/workflows/ci.yml: the root test job no longer runs apt-get install pkg-config libssl-dev. The sdk job keeps it (unchanged SDK build).
  • Docs: README.md build deps, docs/ARTI_UPGRADE.md backend table + step 8, scripts/release-body.md, crates/onionwire-sdk/README.md.
  • crates/onionwire-sdk/Cargo.lock: regenerated — the SDK is a separate workspace and its lock records the root package's dependency list, so cargo test --locked there would otherwise fail with "cannot update the lock file".

Evidence

RED first (unmodified Cargo.toml), then GREEN:

$ cargo test --test tls_backend          # RED, before the change
test default_features_select_the_rustls_backend ... FAILED
  panicked at tests/tls_backend.rs:12: the crate's default features must select Arti's rustls backend

$ cargo test --locked --test tls_backend # GREEN
test rustls_resolves_a_crypto_provider_from_crate_features ... ok
test result: ok. 1 passed

Acceptance commands on the final commit:

$ cargo check --locked                  # exit 0
$ cargo test --locked                   # exit 0 — 292 tests ok, 0 failed, 0 suites FAILED
$ cargo clippy --locked --all-targets -- -D warnings   # exit 0
$ cargo check --locked --no-default-features --features native-tls   # exit 0 (opt-in path still builds)

native-tls is genuinely out of the graph, not just un-defaulted:

$ cargo tree --locked -e features -i native-tls
error: package ID specification `native-tls` did not match any packages

$ cargo tree --locked -e features -i rustls
rustls v0.23.44
└── tor-rtcompat v0.46.0
    └── tor-rtcompat feature "rustls"
        └── arti-client feature "rustls"
            └── onionwire feature "rustls"

Link-level confirmation (same target dir, baseline binary is the pre-change release build):

NEW  (rustls default): readelf -d shows no libssl/libcrypto NEEDED; nm SSL_CTX_new = 0, EVP_ symbols = 448
BASE (native-tls):     nm SSL_CTX_new = 2

OpenSSL TLS symbols are gone; the EVP symbols that remain are SQLCipher's vendored, static OpenSSL (rusqlite feature bundled-sqlcipher-vendored-openssl), which is unrelated to Arti's TLS and still needs perl + make to build — not the -dev headers.

Scope notes

  • crates/onionwire-sdk/Cargo.toml: comment-only edit. The card said not to modify that file; its header comment claimed "the Linux TUI crate keeps native-tls", which this change makes false. No feature, dependency or lock-affecting change — the SDK's resolution is untouched (default-features = false, features = ["rustls"] stays). Flagging it explicitly rather than leaving a knowingly false comment.
  • The old README.md / scripts/release-body.md claim that the binaries link libssl.so.3 dynamically was already false before this change (the baseline release binary has no dynamic libssl NEEDED entry); corrected with the readelf evidence above.
  • .forgejo/workflows/release.yml still installs pkg-config libssl-dev in its build jobs. Left alone: this card scoped the CI edit to ci.yml, and the vendored OpenSSL build is the same in both. Worth a follow-up if the install turns out to be dead weight there too.
  • Android: the root crate default changing to rustls does not alter the SDK/AAR build (it already selected rustls). Not rebuilt here — android-ci.yml/android-release.yml cover it and the AAR only builds on a tag.

Acceptance

  1. cargo check --locked — exit 0, rustls default, no OpenSSL TLS.
  2. cargo test --locked — 292 passed, 0 failed.
  3. cargo clippy --locked --all-targets -- -D warnings — clean.
  4. ci.yml root test job no longer installs libssl-dev; the sdk job still does.
Closes the hardening note "rustls default": the root crate no longer selects Arti's `native-tls` (OpenSSL) backend by default. ## Change - `Cargo.toml`: `default = ["rustls"]` (was `["native-tls"]`), still exposed as an opt-in feature; the crate's TLS default is now the same as the Android SDK's. - `Cargo.toml`: new direct `rustls = { version = "0.23", default-features = false, features = ["ring"] }`. This is load-bearing, not cosmetic: `tor-rtcompat` pulls rustls in with `default-features = false`, and rustls 0.23 resolves its provider from its OWN `ring`/`aws-lc-rs` features — without this pin the backend compiles with zero providers and the first TLS config fails. Same pin and reasoning as `crates/onionwire-sdk/Cargo.toml`. - `tests/tls_backend.rs` (new): a compile-time assertion that the default feature set selects `rustls` and not `native-tls` (the target stops compiling if `default` moves back), plus a runtime check that building a `rustls::ClientConfig` the way Arti does resolves a `CryptoProvider` with no manual install. - `.forgejo/workflows/ci.yml`: the root `test` job no longer runs `apt-get install pkg-config libssl-dev`. The `sdk` job keeps it (unchanged SDK build). - Docs: `README.md` build deps, `docs/ARTI_UPGRADE.md` backend table + step 8, `scripts/release-body.md`, `crates/onionwire-sdk/README.md`. - `crates/onionwire-sdk/Cargo.lock`: regenerated — the SDK is a separate workspace and its lock records the root package's dependency list, so `cargo test --locked` there would otherwise fail with "cannot update the lock file". ## Evidence RED first (unmodified `Cargo.toml`), then GREEN: ``` $ cargo test --test tls_backend # RED, before the change test default_features_select_the_rustls_backend ... FAILED panicked at tests/tls_backend.rs:12: the crate's default features must select Arti's rustls backend $ cargo test --locked --test tls_backend # GREEN test rustls_resolves_a_crypto_provider_from_crate_features ... ok test result: ok. 1 passed ``` Acceptance commands on the final commit: ``` $ cargo check --locked # exit 0 $ cargo test --locked # exit 0 — 292 tests ok, 0 failed, 0 suites FAILED $ cargo clippy --locked --all-targets -- -D warnings # exit 0 $ cargo check --locked --no-default-features --features native-tls # exit 0 (opt-in path still builds) ``` `native-tls` is genuinely out of the graph, not just un-defaulted: ``` $ cargo tree --locked -e features -i native-tls error: package ID specification `native-tls` did not match any packages $ cargo tree --locked -e features -i rustls rustls v0.23.44 └── tor-rtcompat v0.46.0 └── tor-rtcompat feature "rustls" └── arti-client feature "rustls" └── onionwire feature "rustls" ``` Link-level confirmation (same target dir, baseline binary is the pre-change release build): ``` NEW (rustls default): readelf -d shows no libssl/libcrypto NEEDED; nm SSL_CTX_new = 0, EVP_ symbols = 448 BASE (native-tls): nm SSL_CTX_new = 2 ``` OpenSSL TLS symbols are gone; the EVP symbols that remain are SQLCipher's vendored, static OpenSSL (`rusqlite` feature `bundled-sqlcipher-vendored-openssl`), which is unrelated to Arti's TLS and still needs `perl` + `make` to build — not the `-dev` headers. ## Scope notes - `crates/onionwire-sdk/Cargo.toml`: comment-only edit. The card said not to modify that file; its header comment claimed "the Linux TUI crate keeps native-tls", which this change makes false. No feature, dependency or lock-affecting change — the SDK's resolution is untouched (`default-features = false, features = ["rustls"]` stays). Flagging it explicitly rather than leaving a knowingly false comment. - The old `README.md` / `scripts/release-body.md` claim that the binaries link `libssl.so.3` dynamically was already false before this change (the baseline release binary has no dynamic `libssl` NEEDED entry); corrected with the `readelf` evidence above. - `.forgejo/workflows/release.yml` still installs `pkg-config libssl-dev` in its build jobs. Left alone: this card scoped the CI edit to `ci.yml`, and the vendored OpenSSL build is the same in both. Worth a follow-up if the install turns out to be dead weight there too. - Android: the root crate default changing to rustls does not alter the SDK/AAR build (it already selected rustls). Not rebuilt here — `android-ci.yml`/`android-release.yml` cover it and the AAR only builds on a tag. ## Acceptance 1. `cargo check --locked` — exit 0, rustls default, no OpenSSL TLS. 2. `cargo test --locked` — 292 passed, 0 failed. 3. `cargo clippy --locked --all-targets -- -D warnings` — clean. 4. `ci.yml` root `test` job no longer installs `libssl-dev`; the `sdk` job still does.
tls: default to Arti's rustls backend (drop OpenSSL from TLS)
All checks were successful
ci / test (pull_request) Successful in 6m47s
android-ci / android (pull_request) Successful in 8m21s
ci / sdk (pull_request) Successful in 1m25s
69672809ab
Arti's TLS backends are non-additive; the root crate defaulted to
`native-tls` (OpenSSL). Switch `default = ["rustls"]` and pin the `rustls`
crate with its `ring` feature — `tor-rtcompat` pulls rustls in with
`default-features = false`, so without that pin the backend compiles with no
`CryptoProvider` and the first TLS config fails (same reason already recorded
in crates/onionwire-sdk/Cargo.toml).

`native-tls` stays as an opt-in feature. SQLCipher still builds vendored
OpenSSL (`bundled-sqlcipher-vendored-openssl`); that is unrelated to TLS.

- tests/tls_backend.rs: compile-time pin that the default features select
  rustls, plus a runtime check that rustls resolves a provider with no manual
  install.
- ci.yml: the root `test` job no longer installs pkg-config/libssl-dev (the
  SDK job keeps it).
- docs: README build deps, ARTI_UPGRADE backend table, release-body and the
  SDK README now describe the rustls default; the false "binaries link
  libssl.so.3 dynamically" claim is corrected.
- crates/onionwire-sdk/Cargo.lock: regenerated for the root crate's new
  dependency (separate workspace, --locked would otherwise fail).
Merge branch 'main' into wt/t_17e3d3cf-rustls-default
Some checks failed
android-ci / android (pull_request) Successful in 8m17s
ci / test (pull_request) Successful in 4m50s
ci / sdk (pull_request) Successful in 1m6s
ci / fuzz (pull_request) Failing after 58s
049b612169
sirius merged commit 724e0427b0 into main 2026-09-18 01:20:36 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/onionwire!100
No description provided.