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

feat(hyper-rustls): default hyper client support https and http #180

Closed
wants to merge 2 commits into from

Conversation

pseguin2011
Copy link

Support http requests for the metadata server requests

Author: Pierre Seguin [email protected]
Resolves: #179

@dermesser
Copy link
Owner

Thank you for this PR; as an alternative, could you slightly refactor the current function to have one build_hyper_client() (like now), and another build_insecure_http_hyper_client()? Having a secure-by-default API is probably the right thing to do in a security-sensitive area like authentication, and it would allow users to choose for themselves.

In any case, thank you for taking the time to fix this!

@pseguin2011
Copy link
Author

Should I also change the default http client built for ApplicationDefaultCredentialsAuthenticator ?

@dermesser
Copy link
Owner

Most of the checks fail due to #178 which renamed some type parameters. It should be enough to rebase and rename C into S.

Should I also change the default http client built for ApplicationDefaultCredentialsAuthenticator ?

Sorry, which default client build do you mean?

@pseguin2011
Copy link
Author

Well since the metadata server is always over http, should I also manage any default constructors for the authenticator? or would it be too risky?

@dermesser
Copy link
Owner

Well since the metadata server is always over http, should I also manage any default constructors for the authenticator? or would it be too risky?

I think one blocking problem is that a "secure" builder is built by default (https://docs.rs/yup-oauth2/latest/src/yup_oauth2/authenticator.rs.html#441). I'm sorry for not having this in mind earlier (I've grown somewhat estranged from this code base, unfortunately - need to take the time to re-learn it).

Maybe, after all, your original PR (allowing HTTP) is still the best solution. I wonder if there is a practical threat scenario in which this would make a difference; if somebody has access to change your token URL, they could conceivably do more dangerous things in the first place.

I'm sorry for the confusion! This crate has grown quite complex in the meantime.

dermesser added a commit that referenced this pull request Jun 10, 2022
If an attacker could manipulate URLs for token retrieval etc., they
could wreak considerably more havoc than a downgrade attack.
@pseguin2011
Copy link
Author

After giving it some thought, I realize it is probably better to remain secure by default and have a deliberate implementation of an insecure client when using the metadata server.

So here is my proposal:
We close this PR and simply add additional documentation for examples on using the library with the metadata server

@dermesser
Copy link
Owner

Additional documentation sounds good, although note that my commit already enabled HTTP fallback (for all I can see, the token URLs etc. are supplied by the application developer, and they should be HTTPS).

@dermesser dermesser closed this Jun 16, 2022
dermesser added a commit that referenced this pull request Jun 20, 2022
If an attacker could manipulate URLs for token retrieval etc., they
could wreak considerably more havoc than a downgrade attack.
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.

The DefaultHyperClient does not support http - Issue with metadata server authentication
2 participants