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

Added support for Cargo http.cainfo #615

Merged
merged 16 commits into from
Sep 12, 2024
Merged

Conversation

ranger-ross
Copy link
Contributor

This PR adds support for using a custom CA via the Cargo http.cainfo configuration.

See #612 for more info

@bholley bholley requested a review from mystor July 8, 2024 17:48
Copy link
Collaborator

@mystor mystor left a comment

Choose a reason for hiding this comment

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

I'm not sure we want to add a hard dependency on the full cargo crate. That's a pretty heavy dependency to pull in just to read the cargo config file.

The API of the cargo crate is also quite unstable (as noted in the documentation, in fact the latest version appears to have a different API than the 0.65.0 which you're depending on here).

I'm open to us using cargo HTTP configuration options to configure our reqwest client. Ideally we'd shell out to the cargo subcommand with cargo config get, though that feature is unfortunately still unstable (rust-lang/cargo#9301).

For now, to support this unfortunately I think we'd need to parse the cargo config options independently, rather than relying on the cargo crate to do so. Based on the cargo configuration documentation, the process would roughly be to try to parse TOML from each $ANCESTOR_DIR/.cargo/config or $ANCESTOR_DIR/.cargo/config.toml, then try the next ancestor up, followed by finally checking $CARGO_HOME/config[.toml]. There's also a CARGO_HTTP_CAINFO environment variable which would need to be checked.

@ranger-ross
Copy link
Contributor Author

ranger-ross commented Jul 13, 2024

Hey @mystor ,
Thanks, thats a totally fair response. (I was also not in love with taking a dependency on cargo)

I updated this PR to remove the dependency on cargo and self implemented the logic for resolving cargo configurations by following the documentation here.

Let me know what you think 👍

@ranger-ross
Copy link
Contributor Author

Hey there @mystor 👋

I updated this PR to use cargo-config2 instead of Cargo.

Copy link
Collaborator

@mystor mystor left a comment

Choose a reason for hiding this comment

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

I applied some clean-ups and audited the new dependencies. Approving with those changes.

Thanks for the patch!

@mystor mystor merged commit c4ec9a7 into mozilla:main Sep 12, 2024
13 checks passed
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