Repository navigation
fix(api): keep the MapTiler key out of every proxied JSON document - #992
Open
Medformatik wants to merge 1 commit into
Open
Medformatik wants to merge 1 commit into
Medformatik wants to merge 1 commit into
Conversation
Medformatik
force-pushed
the
fix/maptiler-style-key-passthrough
branch
from
November 16, 2026 10:00
b78a677 to
bb3d935
Compare
The proxy rewrote only the style and TileJSON fields it knew and passed any other URL through unchanged, key included. It now strips the key from every URL string in style, TileJSON and sprite JSON, rewrites list-form sprites, and refuses a document in which the key is still present.
Medformatik
force-pushed
the
fix/maptiler-style-key-passthrough
branch
from
November 16, 2026 17:23
bb3d935 to
aa12be1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
The MapTiler proxy keeps the operator's API key on the server and serves style and tile documents publicly with a week of caching. MapTiler writes the caller's key into the URLs inside those documents. The proxy rewrote the fields it knew (
glyphs, a stringsprite, each source'surlandtiles) and passed every other value through unchanged. A key-bearing URL in a field it did not visit, on a MapTiler path it does not proxy or on another MapTiler host would have been served to every visitor. No default style is known to do this today; the change makes the proxy fail closed.Every JSON document the proxy serves (style, TileJSON and sprite JSON) now goes through one path: the known fields are rewritten as before, including the list form of
sprite; the key parameter is removed from every remaining URL string on a MapTiler host, or on any host when its value is the configured key; and a document that still contains the key anywhere is refused with an uncached 502. A removal is logged with a count and no URL.Related work
Fifth layer of the stack that starts with #983.
Verification
maptiler.test.tspasses (36 tests) with six new cases: list-form sprite, key removed from unknown fields with tile placeholders and other parameters kept, a non-MapTiler host, refusal when the key sits inside attribution HTML with nothing in the response or the logs, and sprite JSON with and without the key.pnpm -C apps/api check-typesand Biome pass on the touched files.Release and upgrade impact
No operator action and no migration.