high · M1 · MASVS-STORAGE-1 · PTKD-LEFTOVER-EAS-ENV-SECRET
Secret written in eas.json
eas.json sets a secret (an AI, payment, database or admin key) as a plain value in a build profile's env. eas.json is committed, so everyone with the repository, and its history, has the key. With an EXPO_PUBLIC_ name the value is also built into the app.
How it is exploited
eas.json has `"production": { "env": { "OPENAI_API_KEY": "sk-proj-..." } }` so the build server has it. The repository is public on GitHub (or shared with a contractor), and secret scanners and bots pick the key up within minutes.
Why it matters
Anyone with the repository or its history can use the key: provider bills, data access, admin actions.
How to fix it
- Remove the value from eas.json (and from git history if the repository was ever shared).
- Create it as an EAS environment variable with secret visibility: `eas env:create --name OPENAI_API_KEY --value ... --visibility secret --environment production`.
- Rotate the key at the provider.
- If the app itself needs to call the provider, move that call to a server: an EXPO_PUBLIC_ variable is never secret.
Does your app have this?
PTKD checks your build or your source project for PTKD-LEFTOVER-EAS-ENV-SECRET and every other check in this knowledge base.
Scan your appReferences
Related checks (M1)
- Secret returned in an API response
- App code calls Supabase admin APIs, so the service-role key ships in the app
- Hardcoded secret in the app
- Credential passed in a URL
- Hardcoded secret sent on the wire
- A .env file ships inside the app
- Secret .env file is not ignored by git
- Secret in the Expo app config `extra`, which ships inside the app