cap-go/capgo-skills2 files

Capacitor Security

Comprehensive security guide for Capacitor apps using Capsec scanner. Covers 63+ security rules across secrets, storage, network, authentication, cryptography, and platform-specific vulnerabilities. Use this skill when users need to secure their mobile app or run security audits.

Specification
Skill ID
cap-go/capgo-skills/capacitor-security
Publisher
cap-go
Repository
capgo-skills
Installs
0
Files
2
Synced
Sep 23, 2026
How to use it

Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.

cap-go/capgo-skills/capacitor-securityInstalls these files
  • SKILL.md
  • metadata.json

What this skill tells the agent

Capacitor Security with Capsec

Zero-config security scanning for Capacitor and Ionic apps.

When to Use This Skill

  • User wants to secure their app
  • User asks about security vulnerabilities
  • User needs to run security audit
  • User has hardcoded secrets
  • User needs CI/CD security scanning
  • User asks about OWASP mobile security

Quick Start with Capsec

Run Security Scan

# Scan current directory (no installation needed)
npx capsec scan

# Scan specific path
npx capsec scan ./my-app

# CI mode (exit code 1 on high/critical issues)
npx capsec scan --ci

Output Formats

# CLI output (default)
npx capsec scan

# JSON report
npx capsec scan --output json --output-file report.json

# HTML report
npx capsec scan --output html --output-file security-report.html

Filtering

# Only critical and high severity
npx capsec scan --severity high

# Specific categories
npx capsec scan --categories secrets,network,storage

# Exclude test files
npx capsec scan --exclude "**/test/**,**/*.spec.ts"

Security Rules Reference

Secrets Detection (SEC)

RuleSeverityDescription
SEC001CriticalHardcoded API Keys & Secrets
SEC002HighExposed .env File

What Capsec Detects:

  • AWS Access Keys
  • Google API Keys
  • Firebase Keys
  • Stripe Keys
  • GitHub Tokens
  • JWT Secrets
  • Database Credentials
  • 30+ secret patterns

Fix Example:

// BAD - Hardcoded API key
const API_KEY = 'sk_live_abc123xyz';

// GOOD - Use environment variables
import { Env } from '@capgo/capacitor-env';
const API_KEY = await Env.get({ key: 'API_KEY' });

Storage Security (STO)

RuleSeverityDescription
STO001HighUnencrypted Sensitive Data in Preferences
STO002HighlocalStorage Usage for Sensitive Data
STO003MediumSQLite Database Without Encryption
STO004MediumFilesystem Storage of Sensitive Data
STO005LowInsecure Data Caching
STO006HighKeychain/Keystore Not Used for Credentials

Fix Example:

// BAD - Plain preferences for tokens
import { Preferences } from '@capacitor/preferences';
await Preferences.set({ key: 'auth_token', value: token });

// GOOD - Use secure storage
import { NativeBiometric } from '@capgo/capacitor-native-biometric';
await NativeBiometric.setCredentials({
  username: email,
  password: token,
  server: 'api.myapp.com',
});

Network Security (NET)

RuleSeverityDescription
NET001CriticalHTTP Cleartext Traffic
NET002HighSSL/TLS Certificate Pinning Missing
NET003HighCapacitor Server Cleartext Enabled
NET004MediumInsecure WebSocket Connection
NET005MediumCORS Wildcard Configuration
NET006MediumInsecure Deep Link Validation
NET007LowCapacitor HTTP Plugin Misuse
NET008HighSensitive Data in URL Parameters

Fix Example:

// BAD - HTTP in production
const config: CapacitorConfig = {
  server: {
    cleartext: true,  // Never in production!
  },
};

// GOOD - HTTPS only
const config: CapacitorConfig = {
  server: {
    cleartext: false,
    // Only allow specific domains
    allowNavigation: ['https://api.myapp.com'],
  },
};

Capacitor-Specific (CAP)

RuleSeverityDescription
CAP001HighWebView Debug Mode Enabled
CAP002MediumInsecure Plugin Configuration
CAP003LowVerbose Logging in Production
CAP004HighInsecure allowNavigation
CAP005CriticalNative Bridge Exposure
CAP006CriticalEval Usage with User Input
CAP007MediumMissing Root/Jailbreak Detection
CAP008LowInsecure Plugin Import
CAP009MediumLive Update Security
CAP010HighInsecure postMessage Handler

Fix Example:

// BAD - Debug mode in production
const config: CapacitorConfig = {
  ios: {
    webContentsDebuggingEnabled: true,  // Remove in production!
  },
  android: {
    webContentsDebuggingEnabled: true,  // Remove in production!
  },
};

// GOOD - Only in development
const config: CapacitorConfig = {
  ios: {
    webContentsDebuggingEnabled: process.env.NODE_ENV === 'development',
  },
};

Android Security (AND)

RuleSeverityDescription
AND001HighAndroid Cleartext Traffic Allowed
AND002MediumAndroid Debug Mode Enabled
AND003MediumInsecure Android Permissions
AND004LowAndroid Backup Allowed
AND005HighExported Components Without Permission
AND006MediumWebView JavaScript Enabled Without Safeguards
AND007CriticalInsecure WebView addJavascriptInterface
AND008CriticalHardcoded Signing Key

Fix AndroidManifest.xml:

<!-- BAD -->
<application android:usesCleartextTraffic="true">

<!-- GOOD -->
<application
    android:usesCleartextTraffic="false"
    android:allowBackup="false"
    android:networkSecurityConfig="@xml/network_security_config">

network_security_config.xml:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="false">
        <domain includeSubdomains="true">api.myapp.com</domain>
        <pin-set>
            <pin digest="SHA-256">your-pin-hash</pin>
        </pin-set>
    </domain-config>
</network-security-config>

iOS Security (IOS)

RuleSeverityDescription
IOS001HighApp Transport Security Disabled
IOS002MediumInsecure Keychain Access
IOS003MediumURL Scheme Without Validation
IOS004LowiOS Pasteboard Sensitive Data
IOS005MediumInsecure iOS Entitlements
IOS006LowBackground App Refresh Data Exposure
IOS007MediumMissing iOS Jailbreak Detection
IOS008LowScreenshots Not Disabled for Sensitive Screens

Fix Info.plist:

<!-- BAD - Disables ATS -->
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

<!-- GOOD - Specific exceptions only -->
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>legacy-api.example.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.2</string>
        </dict>
    </dict>
</dict>

Authentication (AUTH)

RuleSeverityDescription
AUTH001CriticalWeak JWT Validation
AUTH002HighInsecure Biometric Implementation
AUTH003HighWeak Random Number Generation
AUTH004MediumMissing Session Timeout
AUTH005HighOAuth State Parameter Missing
AUTH006CriticalHardcoded Credentials in Auth

Fix Example:

// BAD - No JWT validation
const decoded = jwt.decode(token);

// GOOD - Verify JWT signature
const decoded = jwt.verify(token, publicKey, {
  algorithms: ['RS256'],
  issuer: 'https://auth.myapp.com',
  audience: 'myapp',
});

WebView Security (WEB)

RuleSeverityDescription
WEB001CriticalWebView JavaScript Injection
WEB002MediumUnsafe iframe Configuration
WEB003MediumExternal Script Loading
WEB004MediumContent Security Policy Missing
WEB005LowTarget _blank Without noopener

Fix - Add CSP:

<!-- index.html -->
<meta http-equiv="Content-Security-Policy" content="
  default-src 'self';
  script-src 'self';
  style-src 'self' 'unsafe-inline';
  img-src 'self' data: https:;
  connect-src 'self' https://api.myapp.com;
  font-src 'self';
  frame-ancestors 'none';
">

Cryptography (CRY)

| Rule | Severity | Description |

Use this skill in a project

Open any RiverX project, search the Skills panel for cap-go/capgo-skills/capacitor-security, and install it in one click.

Use this skill