Holds the rotating public Mapbox access token used by rnmapbox/maps CI for
fork PRs, where GitHub Actions provides no secrets.
The token here is public by design — anyone can fetch and decode it, and any fork PR could print whatever token CI uses anyway. Defense is not secrecy but:
- a dedicated
pk.token with minimal read scopes (styles:tiles,styles:read,fonts:read,datasets:read) - automatic rotation twice a week (rotate.yml), which also deletes rotated tokens older than 3 days
- no credit card on the Mapbox account: abuse can only exhaust the free tier (map tiles 403 until the month resets), never generate charges. A dedicated CI-only account would additionally isolate quota, but Mapbox signups now require a card, so the tokens live on the existing no-card account.
- kill switch: deleting
mapbox-ci-token.*.encand disabling the rotate cron instantly reverts fork CI to the no-token world, with no change to the maps repo
The AES layer is obfuscation only: it keeps the raw pk. string out of
GitHub secret scanning and token-scraper bots. The obfuscation key is public
(keys/v1.key, mirrored in scripts/ci/fetch-mapbox-token.sh in the maps repo).
URL restrictions (allowedUrls) were considered and rejected: they rely on the
browser Referer header and don't work with the native Maps SDK, which the iOS
Detox CI job uses — a restricted token would break the only job that renders maps.
mapbox-ci-token.v1.enc— the current token, AES-256-CBC (-md sha256, base64, keyed withkeys/v1.key). Written by the rotate workflow.keys/v1.key— obfuscation key, versioned.scripts/rotate-mapbox-token.sh— creates a fresh token via the Mapbox Tokens API, publishes it, deletes expired rotated tokens.
Decode manually:
curl -fsSL https://raw.githubusercontent.com/rnmapbox/ci-config/main/mapbox-ci-token.v1.enc \
| openssl enc -d -aes-256-cbc -base64 -A -md sha256 -k "$(cat keys/v1.key)"- Repo secret
MAPBOX_ADMIN_TOKEN: ansk.token withtokens:read+tokens:writescopes (create at https://account.mapbox.com/access-tokens/). - Repo variable
MAPBOX_USERNAME: the Mapbox account username the tokens belong to. - Run the "Rotate CI Mapbox token" workflow manually once to seed
mapbox-ci-token.v1.enc.
openssl rand -hex 16 > keys/v2.key, bumpKEY_VERSIONinscripts/rotate-mapbox-token.sh, run the rotate workflow (publishesmapbox-ci-token.v2.enc).- Update
URLandOBFUSCATION_KEYinscripts/ci/fetch-mapbox-token.shin the maps repo. - Keep the old
.encfile until release branches referencing it are gone.