android-security-best-practices
Apply Android app security guidance around secrets, storage, network trust, exported components, and least privilege.
What this skill does
# Android Security Best Practices ## When To Use - Use this skill when the request is about: android security review, secret handling android app, exported component security android. - Primary outcome: Apply Android app security guidance around secrets, storage, network trust, exported components, and least privilege. - Read `references/patterns.md` when you need the attack-surface checklist or the storage/network/component decision matrix. - Read `references/scenarios.md` for manifest, backup, WebView, and release-hardening review paths. - Handoff skills when the scope expands: - `android-modernization-upgrade` - `android-ci-cd-release-playstore` ## Workflow 1. Inventory the attack surface first: exported components, intent/deep link entry points, file sharing, WebView usage, local storage, logs, backups, and network trust config. 2. Remove avoidable risk before hardening details: prefer platform pickers and choosers, internal storage, server-issued short-lived tokens, and least-privilege permissions instead of shipping broad access or long-lived secrets. 3. Lock the remaining boundaries explicitly with `android:exported`, component permissions, `FileProvider`, `networkSecurityConfig`, debug-only trust anchors, and immutable `PendingIntent`s. 4. Review sensitive surfaces that often regress in Android apps: WebView JavaScript bridges, backup/data extraction rules, cleartext exceptions, log redaction, and same-developer IPC assumptions. 5. Validate the release posture with reproducible checks, then document residual risks and whether backend enforcement or Play Integrity is advisory or blocking. ## Guardrails - Treat client-side secrets as recoverable by attackers; move trust decisions and privileged API access server-side whenever possible. - Export components only when there is a real external caller, and permission-protect or signature-protect them when the contract is private. - Use network security config to scope debug trust anchors or cleartext exceptions instead of broad manifest toggles. - Redact logs, review backups, and keep sensitive data out of shared external storage by default. ## Anti-Patterns - Hiding API keys in resources, the NDK, or obfuscation and calling that secure. - Leaving `android:exported` or intent filters ambiguous on launchable or IPC components. - Sharing files through raw file paths or overly broad storage permissions instead of `FileProvider` and system surfaces. - Pinning certificates without an operational rotation story or fallback plan. ## Review Focus - Exported activities, services, receivers, and providers with clear ownership and caller expectations. - Secrets, tokens, and backend trust assumptions. - Network trust, debug overrides, cleartext usage, and certificate handling. - File sharing, backups, logs, and user-data leakage paths. - Abuse signals such as Play Integrity only as layered defense, never as the sole authorization model. ## Examples ### Happy path - Scenario: Audit manifests and sharing surfaces for explicit exports, permissions, and `FileProvider` usage. - Command: `rg -n "android:exported|android:permission|FileProvider|grantUriPermissions" examples` ### Edge case - Scenario: Catch insecure backup or network defaults before a release candidate goes out. - Command: `rg -n "networkSecurityConfig|usesCleartextTraffic|allowBackup|fullBackupContent|dataExtractionRules" examples` ### Failure recovery - Scenario: Separate app hardening from modernization or release-pipeline requests. - Command: `python3 scripts/eval_triggers.py --skill android-security-best-practices` ## Done Checklist - Every externally reachable component has explicit exposure and caller constraints. - Secrets, tokens, and trust decisions are not relying on obscurity in the client app. - Network, backup, logging, and sharing behavior have explicit release-safe defaults. - Residual risks and any backend dependencies are documented with clear follow-up work. ## Official References - [https://developer.android.com/privacy-and-security/security-best-practices](https://developer.android.com/privacy-and-security/security-best-practices) - [https://developer.android.com/privacy-and-security/security-tips](https://developer.android.com/privacy-and-security/security-tips) - [https://developer.android.com/privacy-and-security/risks/unsafe-exported-components](https://developer.android.com/privacy-and-security/risks/unsafe-exported-components) - [https://developer.android.com/privacy-and-security/risks/access-control-to-exported-components](https://developer.android.com/privacy-and-security/risks/access-control-to-exported-components) - [https://developer.android.com/privacy-and-security/security-config](https://developer.android.com/privacy-and-security/security-config) - [https://developer.android.com/privacy-and-security/minimize-permission-requests](https://developer.android.com/privacy-and-security/minimize-permission-requests) - [https://developer.android.com/google/play/integrity/overview](https://developer.android.com/google/play/integrity/overview)
Related in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.