home / skills / hoangnguyen0403 / agent-skills-standard / legacy-security
This skill helps harden Android legacy security by enforcing intents, webview, and file exposure best practices for safer apps.
npx playbooks add skill hoangnguyen0403/agent-skills-standard --skill legacy-securityReview the files below or copy the command above to add this skill to your agents.
---
name: Android Legacy Security
description: Standards for Intents, WebViews, and FileProvider
metadata:
labels: [android, security, legacy, intents]
triggers:
files: ['**/*Activity.kt', '**/*WebView*.kt', 'AndroidManifest.xml']
keywords: ['Intent', 'WebView', 'FileProvider', 'javaScriptEnabled']
---
# Android Legacy Security Standards
## **Priority: P0**
## Implementation Guidelines
### Intents
- **Implicit**: Always verify `resolveActivity` before starting.
- **Exported**: Verify `android:exported` logic (as per `security` skill).
- **Data**: Treat all incoming Intent extras as untrusted input.
### WebView
- **JS**: Default to `javaScriptEnabled = false`. Only enable for trusted domains.
- **File Access**: Disable `allowFileAccess` to prevent local file theft via XSS.
### File Exposure
- **FileProvider**: NEVER expose `file://` URIs. Use `FileProvider`.
## Anti-Patterns
- **Implicit Internal**: `**No Implicit for Internal**: Use Explicit Intents (class name).`
- **World Readable**: `**No MODE_WORLD_READABLE**: SharedPreferences/Files.`
## References
- [Hardening Examples](references/implementation.md)
This skill documents Android legacy security standards for Intents, WebView configuration, and safe file exposure. It summarizes high-priority implementation rules and common anti-patterns to prevent common vulnerabilities in legacy Android code. Use it to audit, harden, or refactor mobile apps that interact with external components, web content, or the file system.
The skill inspects intent usage to ensure implicit intents are validated and exported flags follow secure logic. It reviews WebView settings to enforce safe defaults for JavaScript and file access. It checks file handling to ensure file:// URIs are never exposed and FileProvider is used for sharing files securely.
Why prefer explicit intents for internal communication?
Explicit intents target a known component class, preventing other apps from intercepting or spoofing the action.
When is it acceptable to enable JavaScript in WebView?
Only when content is from trusted, validated domains and you have additional XSS mitigations; otherwise keep JavaScript disabled.