high · M1 · MASVS-STORAGE-1 · PTKD-API-SECRET-IN-RESPONSE
Secret returned in an API response
A server response body contained what looks like a credential (API key, token, or private key). Backends should never hand long-lived secrets to the client.
How it is exploited
A backend response body contained what looks like a long-lived credential (an API key or private key). Anyone who can reach that endpoint, or who captures the traffic, extracts a working secret without touching the client binary at all.
Why it matters
Credential compromise straight from the API, usable from an attacker's own infrastructure beyond your rate limits.
How to fix it
- Rotate the exposed secret immediately and remove it from responses.
- Keep provider keys server-side; hand the client only short-lived, least-privilege tokens.
Does your app have this?
PTKD checks your build or your source project for PTKD-API-SECRET-IN-RESPONSE and every other check in this knowledge base.
Scan your appReferences
Related checks (M1)
- 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
- Secret written in eas.json
- 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