Plan capacitor hardening
Skill kensaurus/cursor-kenji/skills/plan-capacitor-hardening
π¦Curated Cursor AI agent skills, slash commands, MCP configs, subagents & rules for full-stack dev β React 19, Next.js 15, Supabase, Tailwind v4, TypeScript
npx -y skills add kensaurus/cursor-kenji --skill plan-capacitor-hardeningAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 6 stars6 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Audit a Capacitor/Ionic hybrid app for native-layer security gaps, then produce a phased hardening plan. Use when the user says "is my Capacitor app secure", "harden my hybrid app", "WebView security", "secure token storage", "deep link OAuth", "cleartext traffic", "exported activity", or is hardening before store submission. Audits four pillars: Data, Auth/Deep-Linking, Network, WebView, plus OTA vs store policy. Plan only until approved. Pairs with plan-secrets-audit, plan-mobile-readiness, mobile-capacitor-platform. Do NOT use for UI polish or React Native perf.
The file declares its own license as MIT. That is the authorβs claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
8.6 KB, ~2.0k tokens by cl100k_base, as published. Nobody here has run it
Capacitor Native-Layer Hardening Audit + Remediation Plan
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.
When this fires
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.
Why a dedicated skill
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.
The audit β four pillars (+ OTA)
1 Β· Data security
- Secrets in the bundle β API keys, tokens hardcoded in JS or build-time env injection.
Bundle is extractable; move secret-key ops server-side. β
plan-secrets-audit - Plaintext token storage β auth tokens in
localStorage,@capacitor/preferences, IndexedDB, plain SQLite. Wrong. Use memory-only or iOS Keychain / Android Keystore (@capacitor-community/secure-storage,capacitor-secure-storage-plugin, Identity Vault). allowBackup(Android) βandroid:allowBackup="true"exfiltrates app data via backups.
2 Β· Authentication & deep linking
- Custom URL scheme OAuth β
myapp://not globally owned; malicious app can intercept. - No PKCE β OAuth2 in native apps must use PKCE.
- Custom scheme vs App/Universal Links β prefer Universal Links (iOS) / App Links
(Android) with
assetlinks.json/ AASA. Note silent verification fallback to browser. - Exported Android components β
exported=true+BROWSABLE+ no validation = common deep-link compromise. Audit every<intent-filter>. - Deep-link input not validated β URI params β
WebView.loadUrl, file access, queries.startsWithhost checks inadequate.
3 Β· Network security
- Non-HTTPS β any
http://in plaintext. cleartext: trueincapacitor.configβ dev/live-reload only; never production.- Missing
network_security_config(Android) βusesCleartextTraffic="false"; pinning for high-assurance (note bypass risks).
4 Β· WebView security
- No / weak CSP β
Content-Security-Policymeta tag scoping loads. - Broad
allowNavigationβ untrusted hosts load with native bridge attached; scope to trusted API origin(s). NotegetPlatform()quirk on navigated URLs. webContentsDebuggingEnabled: truein production β remote inspection; gate to dev.addJavascriptInterface/ bridge exposure β untrusted content + JS interface = Critical RCE vector.setAllowFileAccess*/file://,evalon user input, insecurepostMessage.
5 Β· OTA / live-update governance
- Update channel integrity β OTA bundles signed/encrypted; unauthenticated path = RCE.
- Store-policy β Google permits WebView updates; Apple: OTA must not alter core functionality (App Store violation independent of security).
- Rollback / kill switch β can a bad update be reverted?
Severity aligned with Cap-go CAP001β010 / AND001β008 where applicable.
For each finding: location, gap, exposure, severity, remediation direction.
Procedure
- Inventory. Read
capacitor.config.*,AndroidManifest.xml,Info.plist, network configs, OAuth/deep-link setup, token storage. State what you couldn't see. - Run pillars 1β5. Tag Critical (bridge/
addJavascriptInterfaceto untrusted content, hardcoded signing key, plaintext secrets shipped), High (cleartext, broadallowNavigation, exported component, custom-scheme OAuth w/o PKCE, plaintext tokens), Med (debug flags, allowBackup, weak CSP), Low (logging nits). - Config-vs-production table β dev-only settings live in prod build.
- Phase burndown. Production-config leaks and token storage first.
- Emit
plan-capacitor-hardening.md. End the turn.
Guardrails
- Plan only. No config, manifest, or storage migration edits.
- "Works in the browser" hides all of this. Say so explicitly.
- Dev config is a production vulnerability.
cleartext,webContentsDebuggingEnabled, broadallowNavigationmust not ship. - In-memory or hardware-backed only for tokens/keys β not
Preferences/localStorage. - Universal/App Links + PKCE for sensitive OAuth; custom scheme = High even if "works".
- Cross-hand: bundle secrets β
plan-secrets-audit; deep-link validation βplan-input-validation; submission βplan-mobile-readiness. - Minimal quoting of config/manifest.
Report template β plan-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.
Chains with
- Launch gates β run with
plan-mobile-readinessbefore store submit. plan-secrets-auditβ bundle secrets cross-hand.plan-input-validationβ deep-link / WebView input validation cross-hand.- Execution:
mobile-capacitor-platform,backend-patterns,mobile-emulator-test. - Verify: real-device secure storage + deep-link test; no dev config in release build.
Plan with a strong model; execute with
composer-2.5-execution.mdc.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.