Mobile security
Mobile security guidance protects the app as an untrusted client. It keeps secrets out of the app, protects local session data, checks input from other apps, and uses server proof for sensitive actions. This page extends external integration security and relates to authentication security and secrets and environment security.
Mobile security boundary
The mobile app runs on a device that an attacker may inspect or control. The server must therefore enforce identity, access, business rules, and usage limits instead of trusting app code, app state, or request fields.
The review treats these as separate trust boundaries:
- App bundle: Public to anyone who can obtain and inspect the app.
- Device storage: Exposed on rooted or jailbroken devices and after device compromise.
- External app input: Deep links can be sent by any app or web page.
- Server interface: Requests can be changed outside the app.
- Platform proof: A local biometric result is not, by itself, proof to the server.
References: vibe-security/SKILL.md• L15-18 vibe-security/…/mobile.md• L3-11
Secret handling
The app bundle is a public distribution artifact. Build-time environment values and JavaScript bundle values are readable or decompilable, so they must contain only public settings.
Third-party calls that need a secret use a backend proxy. The app sends an authenticated request to the product server, and the server calls the provider with the protected key. This keeps provider credentials and provider-specific trust decisions outside the device.
| Value or action | Safe boundary |
|---|---|
| Public app settings | Mobile bundle, when exposure is acceptable |
| Provider API keys | Backend only |
| User session token | Protected device credential storage |
| Provider request and policy checks | Backend proxy |
References: vibe-security/…/mobile.md• L3-24 vibe-security/…/secrets-and-env.md• L1
Local credential storage
Session credentials need storage backed by the device keychain or its Android equivalent. Plain app storage is not an acceptable place for long-lived auth tokens because a compromised device can expose it directly.
The storage choice does not remove the need for token expiry, revocation, and server-side validation. Those controls belong to the authentication flow described in authentication security.
References: vibe-security/…/mobile.md• L26-37 vibe-security/…/authentication.md• L1
Deep link handling
Deep links are external input, not trusted app commands. The app validates and cleans every parameter before it uses the value, and it does not place tokens, passwords, or access-granting identifiers in the URL.
Sensitive or destructive actions require a trusted server check and, where needed, user confirmation. The app must not let a link alone change protected state.
The flow below shows the required trust transition for a link that requests an action.
flowchart LR
A[External app or web page] --> B[Deep link]
B --> C[Validate and sanitize input]
C --> D[Authenticated server request]
D --> E{Server authorizes action}
E -->|yes| F[Confirm or perform action]
E -->|no| G[Reject request]
References: vibe-security/…/mobile.md• L39-46 vibe-security/SKILL.md• L15-18
Biometric verification
Local biometric checks can unlock an app feature, but a simple success flag is not strong proof to a server. A device with a bypassed or hooked check could claim success without proving control of a trusted credential.
For a sensitive operation, the server sends a fresh challenge. The device signs it with a hardware-backed key that is available only after the required biometric check. The server verifies the signature before it accepts the operation.
sequenceDiagram
participant S as Server
participant A as Mobile app
participant K as Hardware-backed key
S->>A: Fresh challenge
A->>K: Request signature after biometric check
K-->>A: Challenge signature
A->>S: Signature and request
S-->>A: Accept or reject
References: vibe-security/…/mobile.md• L47-55
Communication protection
Mobile requests carry user-controlled data and cross a network outside the app’s control. The server must authenticate each protected request, authorize the requested resource and action, and validate all values before use.
The mobile client can improve transport safety and error handling, but it cannot replace server enforcement. A client-side role, price, subscription state, feature flag, or rate counter is only a display value until the server checks it.
References: vibe-security/SKILL.md• L15-18 vibe-security/…/authentication.md• L1 vibe-security/…/data-access.md• L1
Change checklist
When these files or sections are changed, remember to consider these:
- When a provider call moves into the app, re-check that its secret and all privileged policy checks remain server-side.
- When a token flow changes, check the storage boundary, token lifetime, revocation path, and server validation together.
- When a deep link route changes, check every parameter and confirm that the route cannot perform a protected action from URL input alone.
- When biometric access protects a server action, check that the server verifies a fresh hardware-backed signature rather than a client boolean.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Secret placed in a mobile bundle | An attacker extracts the key and uses the provider account | Keep the key in a backend proxy |
| Auth token saved in plain app storage | A compromised device exposes the session | Use keychain-backed secure storage and server token controls |
| Deep link parameter used as a trusted command | Another app or site triggers an unsafe action | Validate input and require server authorization and confirmation |
| Biometric success sent as a boolean | A hooked client bypasses the protected action | Sign a server challenge with a hardware-backed key |
| Client-only access or business checks | A modified request bypasses the app’s rules | Enforce identity, access, and business rules on the server |
Key files
| File | Why to read it |
|---|---|
| vibe-security/…/mobile.md | Defines the mobile review model for bundles, storage, deep links, and biometric proof |
| vibe-security/SKILL.md | Defines the rule that the mobile client is not trusted and places mobile review in the wider audit flow |
| vibe-security/…/authentication.md | Provides the related rules for session and identity checks |
| vibe-security/…/secrets-and-env.md | Provides the related rules for secret placement and environment exposure |