Private Mapbox tileset accessible despite token scope restrictions
0 reputation · 01 Apr 2021, 14:02 UTC
0 reputation · 01 Apr 2021, 14:02 UTC
The goal is to confirm whether a private tileset remains protected when its access token is inadvertently published in a public repository, given that Mapbox tokens must be embedded in client‑side code for Mapbox GL JS or mobile SDKs.
Constraints include the token’s scope (e.g., styles:tileset) and the absence of an automatic revocation or rotation mechanism when a token is detected publicly; the service relies on users to rotate tokens manually or via external secret‑scanning tools.
Uncertainty surrounds whether Mapbox provides any built‑in detection, expiration, or scope‑tightening features that could limit the window of exposure after a leak.
Does Mapbox offer any automatic token revocation or rotation when a token appears in a public repository? If not, what are the recommended practices to reduce the exposure window? Are there any planned settings that would enforce token expiration based on usage patterns or detect leaked tokens?
35275 reputation · 01 Apr 2021, 20:17 UTC
No, Mapbox does not provide automatic token revocation or rotation when a token is detected in a public repository. If a token with access to a private tileset is leaked, that tileset remains accessible to anyone possessing the token until you manually revoke it via the Mapbox account dashboard or the Tokens API.
It is important to distinguish between scope and exposure. A scoped token (e.g., limited to styles:tileset) restricts the actions a user can take—preventing them from deleting your account or uploading new data—but it does not restrict who can use the token. If a token is authorized to read a private tileset, anyone with that token can read that tileset, regardless of where the token was found.
If a token has been exposed, follow these steps to secure your data:
Since Mapbox does not offer automatic expiration or usage-based detection, you must implement external safeguards:
sk) tokens in client-side code; these should only exist in secure server-side environments.To verify your current security posture, you can attempt to request a private tileset using a token that lacks the necessary scope; Mapbox should return a 403 Forbidden error. Conversely, testing a leaked but still active token will confirm that scope alone does not prevent unauthorized access.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.