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

How to normalize URL in Http::HeaderMap? #6008

Closed
yangminzhu opened this issue Feb 20, 2019 · 4 comments
Closed

How to normalize URL in Http::HeaderMap? #6008

yangminzhu opened this issue Feb 20, 2019 · 4 comments
Assignees
Labels
enhancement Feature requests. Not bugs or questions.

Comments

@yangminzhu
Copy link
Contributor

Title: How to normalize URL in Http::HeaderMap?

Description:
If a URL path includes double dots (e.g. /data/../info/) or single dot (e.g. /user/./record/), it seems Http::HeaderMap doesn't normalize it by removing the dots in the path.

Sometime this creates issues when a filter is trying to compare the path. For example, a filter may expect to match on path /info/ and it actually wants to match on both /data/../info/ and /info/ because they have the same semantics and will most likely to be interpreted to the same place in the backend.

Question:

  • Should we provide such support in HeaderMap or HeaderUtility::matchHeaders? Or should we simply do it inside a specific filter when needed?

Reference:
https://en.wikipedia.org/wiki/URL_normalization

/cc @liminw @JimmyCYJ

@htuch htuch added the enhancement Feature requests. Not bugs or questions. label Feb 21, 2019
@htuch
Copy link
Member

htuch commented Feb 21, 2019

I think we should add this capability, and while doing so, keep in mind possible path traversal attacks.

@yangminzhu
Copy link
Contributor Author

yangminzhu commented Feb 22, 2019

I can work on this, Could you assign this to me? Also could you clarify a little about the path traversal attacks? I'm not sure how it is related to the change here. Thanks.

@mattklein123, do you have any comments for this?

@eoftedal
Copy link

@eoftedal
Copy link

eoftedal commented Feb 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests. Not bugs or questions.
Projects
None yet
Development

No branches or pull requests

3 participants