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

    1. Remove the value from eas.json (and from git history if the repository was ever shared).
    2. Create it as an EAS environment variable with secret visibility: `eas env:create --name OPENAI_API_KEY --value ... --visibility secret --environment production`.
    3. Rotate the key at the provider.
    4. 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 app

    References

    Related checks (M1)