Android Legacy Security
ASecurityDo not enable JavaScript merely because the WebView loads a URL. Keep it disabled for arbitrary or untrusted user URLs; JavaScript increases the attack surface and can be dangerous if the page can reach privileged native bridges. If a trusted, allowlisted HTTPS site genuinely requires JavaScript, enable it only for that controlled WebView and do not expose broad native APIs through `@JavascriptInterface`. Restrict navigation with a `WebViewClient` (and use a tightly controlled `WebChromeClien...
- 584 stars
- 0 votes
- 0 copies
- 5 views
- Added September 5, 2026
Works with
Security analysis
100/100Pro scans all 18 files and shows the line behind each finding
npx -y skills add HoangNguyen0403/agent-skills-standard --skill android-legacy-security --agent claude-codeAre you the author of Android Legacy Security?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-android-legacy-security-agent-skills-standard)Do not enable JavaScript merely because the WebView loads a URL. Keep it disabled for arbitrary or untrusted user URLs; JavaScript increases the attack surface and can be dangerous if the page can reach privileged native bridges.
If a trusted, allowlisted HTTPS site genuinely requires JavaScript, enable it only for that controlled WebView and do not expose broad native APIs through `@JavascriptInterface`. Restrict navigation with a `WebViewClient` (and use a tightly controlled `WebChromeClient` only when needed), allowing only the expected HTTPS schemes, hosts, and paths. Do not let an untrusted page navigate to a privileged origin.
At minimum, configure the WebView defensively:
```kotlin
webView.settings.apply {
javaScriptEnabled = false // true only for a strictly required, trusted origin
allowFileAccess = false
allowContentAccess = false
allowFileAccessFromFileURLs = false
allowUniversalAccessFromFileURLs = false
}
```
Also reject unexpected URL schemes and hosts in navigation callbacks, avoid loading sensitive local content in the same WebView, use HTTPS, and disable cleartext traffic through the app's network security configuration. Never rely on the URL alone for authorization, and never add a JavaScript interface unless its methods and accepted inputs are narrowly validated.
Files in this skill
- eval-1.baseline.md
- eval-1.with-skill.md
- eval-2.baseline.md
- eval-2.with-skill.md
- eval-3.baseline.md
- eval-3.with-skill.md
- trigger-1.md
- trigger-10.md
- trigger-11.md
- trigger-2.md
- trigger-3.md
- trigger-4.md
- trigger-5.md
- trigger-6.md
- trigger-7.md
- trigger-8.md
- trigger-9.md
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.