Android Security Best Practices
CommunitykrutikJain
Apply Android app security guidance around secrets, storage, network trust, exported components, and least privilege.
Overview
- Repository
- krutikJain/android-agent-skills
- Publisher
- krutikJain
- Stars
- 14
- Forks
- 5
- Bundled files
- 5
- License
- MIT
- Updated
- Mar 25, 2026
Installation
tmp=$(mktemp -d)
git clone --depth 1 https://github.com/krutikJain/android-agent-skills.git "$tmp"
mkdir -p ~/.claude/skills
cp -R "$tmp/skills/android-security-best-practices" ~/.claude/skills/android-security-best-practices
rm -rf "$tmp"tmp=$(mktemp -d)
git clone --depth 1 https://github.com/krutikJain/android-agent-skills.git "$tmp"
mkdir -p ~/.codex/skills
cp -R "$tmp/skills/android-security-best-practices" ~/.codex/skills/android-security-best-practices
rm -rf "$tmp"Install the Android Security Best Practices agent skill from https://github.com/krutikJain/android-agent-skills/tree/main/skills/android-security-best-practices into this project's skills folder.Instructions
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.mdwhen you need the attack-surface checklist or the storage/network/component decision matrix. - Read
references/scenarios.mdfor manifest, backup, WebView, and release-hardening review paths. - Handoff skills when the scope expands:
android-modernization-upgradeandroid-ci-cd-release-playstore
Workflow
- Inventory the attack surface first: exported components, intent/deep link entry points, file sharing, WebView usage, local storage, logs, backups, and network trust config.
- 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.
- Lock the remaining boundaries explicitly with
android:exported, component permissions,FileProvider,networkSecurityConfig, debug-only trust anchors, and immutablePendingIntents. - 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.
- 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:exportedor intent filters ambiguous on launchable or IPC components. - Sharing files through raw file paths or overly broad storage permissions instead of
FileProviderand 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
FileProviderusage. - 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-tips
- 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/security-config
- https://developer.android.com/privacy-and-security/minimize-permission-requests
- https://developer.android.com/google/play/integrity/overview
Bundled files
FAQ
What does Android Security Best Practices do?
Apply Android app security guidance around secrets, storage, network trust, exported components, and least privilege.
Who made Android Security Best Practices?
krutikJain (a community member) publishes it in the krutikJain/android-agent-skills repository on GitHub.
Is Android Security Best Practices free?
Yes. Android Security Best Practices is open source, published by krutikJain under the MIT license.
What comes with Android Security Best Practices?
Its instructions and 5 files the agent reads only when a task needs them, such as references, examples or scripts.
Which agents can use Android Security Best Practices?
Any coding agent that reads SKILL.md files, including Claude Code, Codex, Cursor, GitHub Copilot and Gemini CLI. The agent loads the skill when a task matches its description.
What are agent skills?
An agent skill is a folder with a SKILL.md file: instructions that teach a coding agent how to do one kind of task, and optionally files it can read while it works. The agent keeps only the skill's name and description in mind and reads the rest when a task calls for it.
How are agent skills different from MCP servers?
An MCP server gives an agent new tools to call, code that runs somewhere and returns results. A skill gives it knowledge: how to approach a task with the tools it already has. Many agents use both.
How can my agent test my Android app?
Robomori lets coding agents create, start and control Android emulators and devices from one command, so they can install your app, take screenshots and check dark mode, font sizes and languages.