-
Notifications
You must be signed in to change notification settings - Fork 14
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
Adding features to ipinfo to support Rustls #60
Conversation
…west and add new feature flags for OpenSSL and Rustls. This enhances control over the used TLS implementation.
- fix tests - update test assertions for IP details to reflect new expected values for city, region, location, postal code, and timezone.
Changes:
|
Thanks @aalkhodiry. I will try to review this change this week. |
@aalkhodiry quick update that I was away for the holiday season. Hoping to taking a look at your PR this week. Thanks for your patience. |
Cargo.toml
Outdated
@@ -36,3 +36,8 @@ tokio = { version = "1", features = ["rt-multi-thread", "macros"] } | |||
[profile.release] | |||
overflow-checks = true | |||
lto = true | |||
|
|||
[features] | |||
default = ["openssl"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the following pointers:
- https://docs.rs/reqwest/latest/reqwest/tls/index.html
- reqwest#2025 Consider switching to rustls as the default, and make openssl optional
- cloudflare-rs#133 Add rustls-tls feature to use rustls with reqwest
- minio-rs#61 add feature to switch native-tls, rustls-tls or disable tls at all
@aalkhodiry I believe we should use the following [features]
clause instead:
default = ["default-tls"]
default-tls = ["reqwest/default-tls"]
native-tls = ["reqwest/native-tls"]
rustls-tls = ["reqwest/rustls-tls"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the suggested features.
[features]
default = ["default-tls"]
default-tls = ["reqwest/default-tls"]
native-tls = ["reqwest/native-tls"]
rustls-tls = ["reqwest/rustls-tls"]
adding these ``` default = ["default-tls"] default-tls = ["reqwest/default-tls"] native-tls = ["reqwest/native-tls"] rustls-tls = ["reqwest/rustls-tls"] ``` as segussted by @max-ipinfo in ipinfo#60 (comment)
@aalkhodiry you may need to run a bunch of steps still as CI is detecting a Clippy failure (https://github.com/ipinfo/rust/pull/60/checks?check_run_id=35029056443):
Check out https://github.com/ipinfo/rust/blob/master/.github/workflows/rust.yaml |
sure I will fix them tomorrow |
- Fixes `the borrowed expression implements the required traits` - Changed string formatting from `format!` to direct string interpolation for POST and GET requests in `ipinfo.rs`. - This improves readability and maintains consistency in the codebase.
|
@aalkhodiry I am investigating why some Cargo tests are failing (https://github.com/ipinfo/rust/actions/runs/12571264092):
|
It needs an API Token to be available as an environment variable. I found calls the real service in the tests |
@aalkhodiry tests pass locally for me with my token so something is not being passed correctly in the workflow. I had already updated the token and it's still failing in Github Actions. Investigating further. |
I just run it locally and it passed all the test with API Token |
Found it! It's due to a fundamental Github restriction, limiting access to Github secrets in workflows triggered by
More information in https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/ |
Thank you |
Update dependencies in Cargo.toml to disable default features for reqwest and add new feature flags for OpenSSL and Rustls. This enhances control over the used TLS implementation.