Skip to content

fix(security): upgrade rustls stack to 0.23 — clear RUSTSEC-2026-0098/-0099/-0104 - #439

Open
MattJackson wants to merge 2 commits into
mainfrom
stack/s1
Open

fix(security): upgrade rustls stack to 0.23 — clear RUSTSEC-2026-0098/-0099/-0104#439
MattJackson wants to merge 2 commits into
mainfrom
stack/s1

Conversation

@MattJackson

@MattJackson MattJackson commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Resolves the three rustls certificate-verification advisories. Both commits are @jakewimmer's work (mirrors #419), authorship preserved.

  • tokio-rustls 0.24→0.26 (rustls 0.21→0.23), rustls-native-certs 0.6→0.8 → pulls in rustls-webpki 0.103.x.
  • rustls 0.23 API migration: ServerCertVerifier (verify_tls13_signature, supported_verify_schemes), CertificateCertificateDer, aws-lc-rs crypto provider; TLS-only items gated so --no-default-features builds stay clean.
  • dev-dependency azure_identity 0.5.0→0.20.0 (aad-auth example).

Non-breaking — no public API changes. Safe for a patch release, no major bump. Verified: builds clean (default / rustls / --features all), cargo audit confirms RUSTSEC-2026-0098/-0099/-0104 cleared.

Supersedes #419 — same fix, credit to @jakewimmer.

Out of scope (separate follow-up): azure_core (RUSTSEC-2026-0275, dev-dep) and rkyv (RUSTSEC-2026-0235, transitive under optional rust_decimal).

Reviewer note: please rebase-merge or merge-commit, not squash — this PR carries @jakewimmer's commits with authorship intact; squashing would collapse that credit.

@MattJackson MattJackson changed the title stack/s1 fix(security): upgrade rustls stack to 0.23 — clear RUSTSEC-2026-0098/-0099/-0104 Sep 2, 2026

@SimSmith SimSmith left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a quick look on the go and consulted with GPT: https://chatgpt.com/share/6a985539-a350-83ed-b73f-dadb32415ae3


let builder = ClientConfig::builder().with_safe_defaults();
let builder = ClientConfig::builder_with_provider(Arc::new(aws_lc_rs::default_provider()))
.with_protocol_versions(&[&version::TLS12])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this pinning it to 1.2 only. Meaning 1.3 is not supported anymore? That's a downgrade.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks. You're right, this was negotiating TLS 1.2 only — it crept in during the rustls 0.21→0.23 migration, where with_safe_defaults() (1.2 and 1.3) was replaced with an explicit with_protocol_versions(&[TLS12]); there was no reason to cap it. Fixed here: it now uses with_safe_default_protocol_versions(), so it negotiates 1.3 when available and falls back to 1.2 for older servers. Verified against SQL Server 2022.

Comment thread Cargo.toml Outdated

[dependencies.rustls-pemfile]
version = "1"
version = "0.26"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pulls in rustls-webpki but the security patched 0.103.13 version is not required here (https://rustsec.org/advisories/RUSTSEC-2026-0104.html). A user might accidentally pull in 0.103.12, for example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. rustls-webpki was only transitive here (via tokio-rustls), so nothing held the floor at the RUSTSEC-2026-0104 fix and a downstream resolve could pick <0.103.13. Addressed: bumped the tokio-rustls floor and added an explicit rustls-webpki = ">=0.103.13" (gated behind the rustls feature) so the patched version can't be resolved away. Thanks!

event!(Level::INFO, "Performing a TLS handshake");

let builder = ClientConfig::builder().with_safe_defaults();
let builder = ClientConfig::builder_with_provider(Arc::new(aws_lc_rs::default_provider()))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This always construct with aws_lc_rs as a crypto provider. Consider allowing an application to install their own and get
CryptoProvider::get_default() if it exist. Otherwise fallback to aws_lc_rs as the default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion, thanks @SimSmith — agreed it's better to honor a process-installed CryptoProvider::get_default() and fall back to aws-lc-rs only as the default, so apps using ring/a FIPS provider aren't forced onto aws-lc-rs.

I'd like to keep this PR scoped to the security fix (clearing the rustls CVEs, mirroring @jakewimmer's #419) so it can land as a clean patch, and do the crypto-provider flexibility as a small focused follow-up. I'll track it separately so it isn't lost.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: implemented — it now honors CryptoProvider::get_default() and falls back to aws-lc-rs. It's in the stack as #446. Thanks again for the suggestion.

Upgrade tokio-rustls to 0.26, rustls to 0.23, and rustls-native-certs to
0.8 to resolve RUSTSEC-2024-0421 and RUSTSEC-2025-0010.

Migrate the TLS stream to the rustls 0.23 API. Switch the crypto provider
to aws-lc-rs via builder_with_provider to avoid the dual-provider conflict
that tokio-rustls 0.26 introduces when ring is also in the dependency graph.

Pin to TLS 1.2 to prevent TLS 1.3 KeyUpdate messages from triggering
UnexpectedEof on the macOS CI runner.

(cherry picked from commit d46e4c0)
azure_core 0.20.0 switched from reqwest 0.11 to reqwest 0.12, which
pulls in rustls 0.23 and rustls-webpki 0.103.13. Bumping azure_identity
to 0.20.0 closes RUSTSEC-2026-0098, 0099, and 0104 in the dev build
without any changes to the production stack.

client_credentials_flow::perform now takes &str for the client secret.
Updated aad-auth.rs to pass raw env var strings and dropped the oauth2
ClientId/ClientSecret wrappers. Also bump reqwest 0.11 -> 0.12 and
oauth2 4.2.3 -> 5.0 in dev-dependencies to match.

Remove .cargo/audit.toml - the suppressions are no longer needed.

(cherry picked from commit 0e90db7)
@MattJackson

Copy link
Copy Markdown
Contributor Author

all 8 stacks are now green thank you to everyone for all the suggestions, if anything else comes up ill fix and adjust

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.

3 participants