-
Notifications
You must be signed in to change notification settings - Fork 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 an option to hardcode TileJSON tiles URL by providing a header in requests #6021
Add an option to hardcode TileJSON tiles URL by providing a header in requests #6021
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #6021 +/- ##
=============================================
- Coverage 69.73% 69.73% -0.01%
Complexity 17314 17314
=============================================
Files 1960 1960
Lines 74267 74269 +2
Branches 7603 7604 +1
=============================================
- Hits 51793 51791 -2
- Misses 19831 19834 +3
- Partials 2643 2644 +1 ☔ View full report in Codecov by Sentry. |
Not sure I understand this PR. Why is it needed, could this be done by a Gateway and is this vulnerable to X-Site attacks? |
The problem I'm trying to solve is that the users send their requests to cdn.digitransit.fi domain but the cdn sends the requests to api.digitransit.fi domain, which is also what shows up as the host when the request arrives to OTP. Additionally, since our cdn doesn't support caching based on headers, we have different paths for different languages but our proxy translates those paths into accept-language headers. Also, our API requires API keys in requests. OTP on the other hand, by default, creates the tiles url in the TileJSON file from the request host and path. So for instance, I thought about different ways to exploit this and I think your concern is valid. If the tilejson files are cached somewhere, it's possible that someone can "corrupt" the cache with tiles url that points to some malicious endpoint. However, this problem wouldn't affect my project since we would always rewrite the header in our proxy before it enters OTP and we wouldn't cache this file. I think this leaves three options:
|
I will discover if it's possible for us to patch the tiles url in our proxy instead of having OTP do it. |
I found a way to solve this issue by patching the response in our proxy, so I will close this pr. |
Summary
The request URL that OTP knows differs in many ways from what the users use through the Digitransit APIs. Therefore, we need to control the tiles URL in the TileJSON file on a request basis through a header. This PR introduces
X-OTP-Tilejson-Url
to achieve that.Issue
Minor sandbox addition, no issue.
Unit tests
Added tests.
Documentation
Updated documentation.
Changelog
Sandbox changelog will be updated.