/kenji:plan-capacitor-hardeningfrom kenji skills
Plan-only security audit for Capacitor native layer: WebView config, token storage, deep links, OAuth, cleartext traffic, exported activities. Produces a phased remediation plan without making edits.
Ships in kenji skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Degree of freedom: HIGH — native-layer inventory and plan. Stay plan-only. No config, manifest, or code edits until approved.
| Skill | Owns |
|---|---|
| plan-capacitor-hardening (this) | Native-layer / WebView security plan |
plan-mobile-readiness | Store submission mechanics |
enhance-capacitor-ui | Hybrid shell UI |
Propose:
server.cleartextandwebContentsDebuggingEnabledfalse in prod; move auth tokens off Preferences onto Keychain/Keystore. Risk: release APK allows remote WebView inspect + plaintext token backup exfil. Keep-working: iOS ATS already blocks cleartext. Phase: Phase 1 — strip dev config from prod.
Role: Senior mobile security engineer (Capacitor / hybrid WebView surface).
Task: Inventory capacitor.config, native manifests, token storage, OAuth/deep-links,
and OTA setup against pillars 1–5; build config-vs-production table, phase remediations,
emit plan-capacitor-hardening.md. Audit & plan only — no config, manifest, or code
edits until approved.
Audit the native layer the web view hides. Change nothing until approved.
Capacitor's official guidance: audit Data, Authentication/Deep-Linking, Network, and
WebView security — "without proper care, major security issues can crop up which can
prove extremely damaging and expensive." Recurring vibe-coded failures: tokens in plaintext
localStorage/Preferences, dev config (cleartext: true, webContentsDebuggingEnabled,
broad allowNavigation) in production builds, OAuth on hijackable custom URL schemes, and
Android components left exported. Every finding here is invisible to web-only review.
Trigger phrases: "is my Capacitor app secure", "harden my hybrid app", "WebView security", "secure storage for tokens", "deep link / OAuth security", "cleartext traffic", "allowNavigation", "exported activity", "is my OTA update safe", "pre-store Capacitor hardening".
Do not fire for: UI polish (enhance-capacitor-ui), RN perf (mobile-rn-performance),
or store paperwork (plan-mobile-readiness — pairs with this). This owns the native-layer
security surface.
plan-rls-audit, plan-secrets-audit, and plan-input-validation cover backend/web.
None know capacitor.config, AndroidManifest.xml, Info.plist, the WebView bridge, or
Keychain/Keystore. Hybrid-native gaps are invisible if you only review web code.
plan-secrets-auditlocalStorage, @capacitor/preferences,
IndexedDB, plain SQLite. Wrong. Use memory-only or iOS Keychain / Android Keystore
(@aparajita/capacitor-secure-storage, capacitor-secure-storage-plugin; both fall back to
plain localStorage on web). Ionic Identity Vault: no new sales since 2025-02.allowBackup (Android) — android:allowBackup="true" exfiltrates app data via backups.myapp:// not globally owned; malicious app can intercept.assetlinks.json / AASA. Note silent verification fallback to browser.exported=true + BROWSABLE + no validation = common
deep-link compromise. Audit every <intent-filter>.WebView.loadUrl, file access, queries.
startsWith host checks inadequate.http:// in plaintext.cleartext: true in capacitor.config — dev/live-reload only; never production.network_security_config (Android) — usesCleartextTraffic="false"; pinning
for high-assurance (note bypass risks).Content-Security-Policy meta tag scoping loads.allowNavigation — untrusted hosts load with native bridge attached; scope to
trusted API origin(s). Note getPlatform() quirk on navigated URLs.webContentsDebuggingEnabled: true in production — remote inspection; gate to dev.addJavascriptInterface / bridge exposure — untrusted content + JS interface =
Critical RCE vector.setAllowFileAccess* / file://, eval on user input, insecure postMessage.StatusBar.setBackgroundColor, setOverlaysWebView, and the overlaysWebView / backgroundColor config have no effect with targetSdkVersion 36 (Capacitor 8 replaced them with core SystemBars); not a security hole, but flag it as dead config whose removal is owed to mobile-capacitor-platform § Native shell plumbing.Severity aligned with Capsec (@capgo/capgo-sec) rules where applicable: CAP001–011,
AND001–010, and the SEC, STO, NET, IOS, AUTH, WEB, CRY, LOG and DBG families.
npx @capgo/capgo-sec rules lists the current set.
For each finding: location, gap, exposure, severity, remediation direction.
capacitor.config.*, AndroidManifest.xml, Info.plist, network
configs, OAuth/deep-link setup, token storage. State what you couldn't see.addJavascriptInterface to untrusted
content, hardcoded signing key, plaintext secrets shipped), High (cleartext, broad
allowNavigation, exported component, custom-scheme OAuth w/o PKCE, plaintext tokens),
Med (debug flags, allowBackup, weak CSP), Low (logging nits).plan-capacitor-hardening.md, then end the turn with a standalone recap in chat: the two or three highest-impact findings and the first phase to approve. The file is the deliverable — write it before the recap.cleartext, webContentsDebuggingEnabled,
broad allowNavigation must not ship.Preferences/localStorage.plan-secrets-audit; deep-link validation →
plan-input-validation; submission → plan-mobile-readiness.plan-secrets-audit; store paperwork → plan-mobile-readinessplan-capacitor-hardening.md# Capacitor Native-Layer Hardening Audit — <app>
_Audit-only. Native security. Nothing changes until each phase is approved._
_These findings are invisible to web-only review._
## Scope
- Inspected: capacitor.config ☐ AndroidManifest ☐ Info.plist ☐ token storage ☐ OAuth ☐ OTA ☐
- Platforms: iOS ☐ Android ☐ | Assumptions: …
## Dev-config-in-production
| Setting | Prod value | Risk | Direction |
|---------|------------|------|-----------|
| server.cleartext | true | plaintext HTTP | false |
| webContentsDebuggingEnabled | true | remote inspection | dev-only |
| server.allowNavigation | ["*"] | bridge on untrusted origin | scope to API |
## Verdict
| Pillar | Crit | High | Med | Worst item |
|--------|------|------|-----|-----------|
| Data | n | n | n | tokens in localStorage |
| Auth/Deep-link | n | n | n | custom-scheme OAuth, no PKCE |
| Network | n | n | n | cleartext enabled |
| WebView | n | n | n | bridge exposed |
| OTA | n | n | n | unsigned channel |
## Findings
| # | Pillar | Location | Gap | Sev | Direction |
|---|--------|----------|-----|-----|-----------|
## Phased burndown
- **Phase 1 — Strip dev config from prod** → `mobile-capacitor-platform`
- **Phase 2 — Secure token storage** → `mobile-capacitor-platform` / `plan-secrets-audit`
- **Phase 3 — Auth & deep-link** → PKCE, App/Universal Links, exported review
- **Phase 4 — WebView & network** → CSP, network_security_config, bridge exposure
- **Phase 5 — OTA governance** → sign channel, store-policy, rollback
## Execution handoff
Re-audit native files after each phase; verify secure storage + deep-links on real devices.
plan-mobile-readiness before store submit.plan-secrets-audit — bundle secrets cross-hand.plan-input-validation — deep-link / WebView input validation cross-hand.mobile-capacitor-platform, backend-patterns, mobile-emulator-test; native-feel chrome and design → enhance-mobile-native-feel.Plan at high effort. Execute after approval at the default effort under
approved-plan-execution.mdc(no reward hacking, no feature deletion).
What SKILL.md sets; muted values are Claude Code's defaults
highThree short reads, in order
capacitor, security-audit, webview, mobile-security, remediation-plan
162 skills in this plugin
/audit-accessibilityWCAG 2.2 AA audit via playwright-cli: axe-core, keyboard, contrast, target size, focus, ARIA. Use when "audit accessibility", "check a11y", "WCAG audit", "check keyboard nav", or "test screen reader".
/audit-agent-speedMeasure and fix a slow coding-agent setup: status line, hooks, instruction bloat, effort, worktree pile-up, antivirus and indexer scans. Use when "Claude is slow" or "CPU is pinned". App speed → audit-performance.
/audit-analyticsRead-only audit of product-analytics events (PostHog, Amplitude, Mixpanel, GA4): taxonomy, funnels, consent-gated firing, dead or duplicate events. Use when "audit our analytics", "are we tracking the right events", or "funnel instrumentation".
/audit-auth-flowsRead-only audit of app-layer auth: route×gate matrix, session lifecycle, OAuth, provider traps (getSession vs getUser, middleware-only gates, CVE-2025-29927). Use when "audit our auth" or "check middleware protection". RLS → plan-rls-audit.
/audit-backend-architectureRead-only backend-architecture audit and pattern advisor, gated by stack. Use when "audit backend architecture", "which pattern should I use", "am I over-engineering", or "sync vs event-driven". Enforced boundaries → enhance-arch-boundaries.
/audit-bundle-sizeAnalyse and shrink a web app's JavaScript bundle. Use when "reduce bundle size", "code splitting", "slow initial load", or "why is the bundle so big". Runtime → audit-performance.
npx claudepluginhub kensaurus/skills --plugin kenjiOther plugins' skills for the same job