No debug APIs or test endpoints in release build
Why it matters
A production build that points to staging APIs or includes debug tooling exposes real users to test data, unstable endpoints, and developer-only interfaces. More critically, staging endpoints typically have weaker auth, lower rate limits, and no data residency guarantees — a production release hitting a staging backend may log user PII into non-compliant systems. CWE-489 (active debug code) and CWE-200 (information exposure) both apply: redux-logger printing state trees to device logs, or a localhost URL falling back to a staging server, creates information exposure paths that violate user trust and may constitute a GDPR Art. 5 processing purpose violation. App store reviewers who discover staging URLs during dynamic analysis can reject the binary.
Severity rationale
High because production builds pointing to staging APIs expose real user data to non-compliant endpoints and give reviewers grounds to reject binaries containing active debug tooling.
Remediation
Gate all debug tooling behind __DEV__ and drive API URLs from environment variables, never from hardcoded strings in source.
// src/config.ts
export const API_URL = process.env.EXPO_PUBLIC_API_URL ?? 'https://api.yourapp.com';
// Conditionally load debug middleware
const middleware: Middleware[] = [thunk];
if (__DEV__) {
const { createLogger } = await import('redux-logger');
middleware.push(createLogger());
}
Set EXPO_PUBLIC_API_URL as an EAS secret for production builds (eas secret:create --scope project --name EXPO_PUBLIC_API_URL --value https://api.yourapp.com). Verify by running eas build --profile production --local and grepping the bundle for staging hostnames before submitting.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the App Store Readiness Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-489 — Active Debug Code
- cwe · CWE-200 — Exposure of Sensitive Information to an Unauthorized Actor
- gdpr · Art. 5 — Principles relating to processing of personal data
Taxons
History
- 2026-04-18·v1.0.0·Initial import from mobile-store-readiness·automated