-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add Host extractor #827
Add Host extractor #827
Conversation
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.
Good stuff! Thanks for working on this 😃
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.
The code looks good!
Wanna add an entry to the changelog as well? Then we can merge this.
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.
Thanks!
Head branch was pushed to by a user without write access
I don't think axum should trust Here's a recent article about |
@bluetech I guess it also applies to the |
The client is supposed to set the Host header - it is expected. But the client is not supposed to set |
My suggestion is to make it configurable, like Django does. |
I'm struggling to see the practical implication.
|
Unless the user is somehow able to override the proxys set header, I don't know enough about proxy servers to know what's common/possible. |
@bluetech clients can also set the
What makes |
Hm, can JavaScript Edit: Not forbidden (would've been surprising to see an |
I started writing a longer explanation, but I found an article which does so already: https://portswigger.net/web-security/host-header/exploiting. Also https://portswigger.net/web-security/host-header. |
I've spoken to the lead maintainer of actix-web and think we should keep things as they are now, but add a note to the docs about the security risks. I'll do that. |
A warning is good, thanks. I would still recommend following what Django does, namely I also looked at what Ruby on Rails does -- they once trusted I look to Django and Ruby on Rails because they're the most popular web frameworks and have had to deal with every security issue under the sun, so "just do what they do" is a decent heuristic. |
Axum doesn't have something similar to Rails' |
Right, I guess it depends on what is the usecase for the Host extractor in the first place. |
Motivation
This pr closes #826, implementing the host extractor.
Solution
uri
to see if it's already been provided, returning if it has"host"
header value and return if it was present