Skip to content

Upgrade reqwest to 0.13#18550

Merged
zanieb merged 88 commits intomainfrom
zb/upgrade-reqwest
Mar 23, 2026
Merged

Upgrade reqwest to 0.13#18550
zanieb merged 88 commits intomainfrom
zb/upgrade-reqwest

Conversation

@zanieb
Copy link
Copy Markdown
Member

@zanieb zanieb commented Mar 18, 2026

The following user-facing changes are included here:

  • aws-lc is used instead of ring for a cryptography backend
    • Expands our certificate signature algorithm support to include ECDSA_P256_SHA512, ECDSA_P384_SHA512, ECDSA_P521_SHA256, ECDSA_P521_SHA384, and ECDSA_P521_SHA512
  • --native-tls is deprecated in favor of a new --system-certs flag, avoiding confusion with the TLS implementation used (we use rustls not native-tls, see prior confusion at Consider using the system SSL library, i.e., OpenSSL instead of rusttls / ring #11595)
  • NASM is a new build requirement on Windows, it is required by aws-lc on x86-64 and i386
  • rustls-platform-verifier is used instead of rustls-native-certs for system certificate verification
    • On macOS, certificate validation is now delegated to Security.framework (SecTrust). Performance when using --system-certs is improved by avoiding exporting and parsing all the certificates from the keychain at startup.
    • On Windows, certificate validation is now delegated to CertGetCertificateChain and CertVerifyCertificateChainPolicy
    • On Linux, certificate validation should be approximately unchanged
    • Some previously failing chains may succeed, and some previously accepted chains may fail; generally, this should result in behavior closer matching browsers and other native applications
    • macOS and Windows may now perform live OCSP fetches for early revocation, which could add latency to some requests
  • Empty SSL_CERT_FILE values are ignored (for consistency with SSL_CERT_DIR)

The following internal changes are included here:

This is a replacement of #17543 with an updated description. See that pull request for prior discussion. I've made the following changes from the initial approach there:

  • Previously, the native-tls TLS implementation was added which included an OpenSSL build. We don't currently use the native-tls implementation, but the --native-tls flag there was erroneously updated to enable it.
  • Previously, there was a --tls-backend flag to toggle between native-tls and rustls. Since we currently always use rustls, this is deferred to future work (if we need it at all).
  • Previously, there were unintentional breaking changes to SSL_CERT_FILE and SSL_CERT_DIR handling, including merging with the base certificates instead of replacing them, dropping support for OpenSSL hash-named certificate files, skipping deduplication of certificates. Here, we retain use of rustls-native-certs for loading certificates from the system as it handles these edge cases.

Closes #17427

salmonsd added 30 commits March 9, 2026 11:22
Copy link
Copy Markdown
Contributor

@geofft geofft left a comment

Choose a reason for hiding this comment

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

If you've already talked/thought about this please disregard, but, I'd be a little hesitant to turn on OCSP checking by default. The security benefit is minimal (assuming that it's in fail-open mode when the OCSP responder cannot be reached) and the potential for inexplicable hangs or connection failures seems high.

Comment on lines +40 to +42
a PEM-encoded certificate bundle (e.g., `certs.pem`, `ca-bundle.crt`), or set
[`SSL_CERT_DIR`](../../reference/environment.md#ssl_cert_dir) to one or more directories containing
PEM-encoded certificate files. Multiple entries are supported, separated using a platform-specific
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you load every file in the directory, or do you need the OpenSSL-style abcd1234.0 hash symlinks to be present (man openssl-rehash)? Do you read every file regardless of extension in that directory?

(I see the mention of "dropping support for OpenSSL hash-named certificate files" in your PR description but I don't totally follow what that means about the current state of things.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

#17543 reimplemented the logic from rustls-native-certs and accidentally dropped support for the OpenSSL-style files.

Here, we retain use of rustls-native-certs for loading and thus follow the semantics defined there. Previously, they gated reads to OpenSSL-style files and other known certificate extensions, but as of the latest version, they read every file.

@zanieb
Copy link
Copy Markdown
Member Author

zanieb commented Mar 19, 2026

I'd be a little hesitant to turn on OCSP checking by default.

I do not know if we have control over this. I will look into it though. There has not been prior discussion, this item in the description is just from me exploring the possible implications of the dependency change.

@zanieb
Copy link
Copy Markdown
Member Author

zanieb commented Mar 19, 2026

We chatted briefly in Discord — I think OCSP is not something we can control but should be fairly limited.

@zanieb zanieb temporarily deployed to uv-test-registries March 19, 2026 19:04 — with GitHub Actions Inactive
Copy link
Copy Markdown
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

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

LGTM! I agree with @geofft about the OSCP checks not being optimal but also agreed that there's nothing we can do about that (at least until rustls exposes a generic API for turning that knob on each platform verifier).

@zanieb zanieb temporarily deployed to uv-test-publish March 20, 2026 14:21 — with GitHub Actions Inactive
@zanieb zanieb temporarily deployed to uv-test-registries March 20, 2026 14:21 — with GitHub Actions Inactive
Co-authored-by: Zanie Blue <contact@zanie.dev>
@zanieb zanieb force-pushed the zb/upgrade-reqwest branch from 34dc0bc to a5ef05c Compare March 20, 2026 19:41
sudo dnf install gcc
```

On Windows, [NASM](https://www.nasm.us/) is required for building the TLS backend (`aws-lc-sys`). If
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we expose the cargo feature for user and distributors that don't want to compile NASM?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hm I thought the feature was already enabled, let me double check...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@zanieb zanieb temporarily deployed to uv-test-publish March 23, 2026 18:06 — with GitHub Actions Inactive
@zanieb zanieb merged commit b6854d7 into main Mar 23, 2026
110 checks passed
@zanieb zanieb deleted the zb/upgrade-reqwest branch March 23, 2026 18:22
@zanieb zanieb added the breaking A breaking change label Mar 23, 2026
konstin pushed a commit that referenced this pull request Mar 24, 2026
The following user-facing changes are included here:

- `aws-lc` is used instead of `ring` for a cryptography backend
- Expands our certificate signature algorithm support to include
ECDSA_P256_SHA512, ECDSA_P384_SHA512, ECDSA_P521_SHA256,
ECDSA_P521_SHA384, and ECDSA_P521_SHA512
- `--native-tls` is deprecated in favor of a new `--system-certs` flag,
avoiding confusion with the TLS implementation used (we use `rustls` not
`native-tls`, see prior confusion at
#11595)
- NASM is a new build requirement on Windows, it is required by `aws-lc`
on x86-64 and i386
- `rustls-platform-verifier` is used instead of `rustls-native-certs`
for system certificate verification
- On macOS, certificate validation is now delegated to
`Security.framework` (`SecTrust`). Performance when using
`--system-certs` is improved by avoiding exporting and parsing all the
certificates from the keychain at startup.
- On Windows, certificate validation is now delegated to
`CertGetCertificateChain` and `CertVerifyCertificateChainPolicy`
    - On Linux, certificate validation should be approximately unchanged
- Some previously failing chains may succeed, and some previously
accepted chains may fail; generally, this should result in behavior
closer matching browsers and other native applications
- macOS and Windows may now perform live OCSP fetches for early
revocation, which could add latency to some requests
- Empty `SSL_CERT_FILE` values are ignored (for consistency with
`SSL_CERT_DIR`)

The following internal changes are included here:

- Certificate loading has been refactored to use a newtype with helper
methods
- The certificate tests have been rewritten
- We use `webpki-root-certs` instead of `webpki-roots`, see
#17543 (comment)
- We request `identity` encoding for range requests, see
astral-sh/async_http_range_reader#3 (comment)
- Various dependencies (including forks) updates to versions which use
reqwest 0.13+

This is a replacement of #17543 with an updated description. See that
pull request for prior discussion. I've made the following changes from
the initial approach there:

- Previously, the `native-tls` TLS implementation was added which
included an OpenSSL build. We don't currently use the `native-tls`
implementation, but the `--native-tls` flag there was erroneously
updated to enable it.
- Previously, there was a `--tls-backend` flag to toggle between
`native-tls` and `rustls`. Since we currently always use `rustls`, this
is deferred to future work (if we need it at all).
- Previously, there were unintentional breaking changes to
`SSL_CERT_FILE` and `SSL_CERT_DIR` handling, including merging with the
base certificates instead of replacing them, dropping support for
OpenSSL hash-named certificate files, skipping deduplication of
certificates. Here, we retain use of `rustls-native-certs` for loading
certificates from the system as it handles these edge cases.


Closes #17427

---------

Co-authored-by: salmonsd <22984014+salmonsd@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking A breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrading reqwest to 0.13.1 to improve TLS experience

5 participants