Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing add_trust_anchors method due to lax rustls versioning #677

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

cdown
Copy link
Contributor

@cdown cdown commented Nov 2, 2023

Upon upgrading to 2.8.0, I got the following compile error from inside ureq:

error[E0599]: no method named `add_trust_anchors` found for struct `RootCertStore` in the current scope
   --> /home/cdown/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ureq-2.8.0/src/rtls.rs:102:16
    |
102 |     root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| {
    |     -----------^^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `add_server_trust_anchors`

The reason is because add_trust_anchors was only added in rustls 0.21.6, but ureq only specifies that any 0.21 is required. As such, if you are already using a compliant, earlier version, the method does not exist and the compile fails.

Pin to >=0.21.6 to make sure this method exists.

Originally introduced in 50fd1fe ("Update deps").

Upon upgrading to 2.8.0, I got the following compile error from inside `ureq`:

    error[E0599]: no method named `add_trust_anchors` found for struct `RootCertStore` in the current scope
       --> /home/cdown/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ureq-2.8.0/src/rtls.rs:102:16
        |
    102 |     root_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| {
        |     -----------^^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `add_server_trust_anchors`

The reason is because `add_trust_anchors` was only added in rustls
0.21.6, but ureq only specifies that any 0.21 is required. As such, if
you are already using a compliant, earlier version, the method does not
exist and the compile fails.

Pin to >=0.21.6 to make sure this method exists.

Originally introduced in 50fd1fe ("Update deps").
@cdown cdown force-pushed the cdown/2023-11-02/fix_rustls_version branch from 372a9e7 to 2e2c1fc Compare November 2, 2023 12:40
@cdown
Copy link
Contributor Author

cdown commented Nov 9, 2023

Hi there, let me know if you see any changes needed :-) Just to show this is a general problem and not just with my repositories, some other PRs failing with this issue I see from a cursory look:

@algesten
Copy link
Owner

algesten commented Nov 9, 2023

Sorry!

It fell off my radar. Thanks for reminding me.

@algesten algesten merged commit 916ffbf into algesten:main Nov 9, 2023
36 of 41 checks passed
@cdown
Copy link
Contributor Author

cdown commented Nov 10, 2023

Thanks for looking!

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.

2 participants