Token导航 LogoToken导航TokenDH.com
前端设计敏感数据github未标认证来源可访问许可证需确认审计通过

capacitor-security电容器安全

Agent Skill

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

总安装

5,160

周安装

215

GitHub Stars

31

下载量

1,720
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:capacitor-security(电容器安全)
来源仓库:https://github.com/cap-go/capgo-skills
仓库路径:skills/capacitor-security
安装命令:
npx skills add https://github.com/cap-go/capgo-skills --skill capacitor-security
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/cap-go/capgo-skills --skill capacitor-security

简介

capacitor-security 集成 capsec 工具进行零配置安全扫描,识别硬编码密钥与漏洞。

  • 适用于定期审计、CI 流水线加固或对 OWASP 移动安全关注的项目。
  • 输出多种格式报告并支持 CI 模式退出码,便于自动化流程集成。
  • 不能替代人工安全评审,尤其涉及业务逻辑与数据流时应结合上下文判断。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

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)

RuleSeverityDescription
CRY001CriticalWeak Cryptographic Algorithm
CRY002CriticalHardcoded Encryption Key
CRY003HighInsecure Random IV Generation
CRY004HighWeak Password Hashing

Fix Example:

// BAD - Weak algorithm
const encrypted = CryptoJS.DES.encrypt(data, key);

// GOOD - Strong algorithm
const encrypted = CryptoJS.AES.encrypt(data, key, {
  mode: CryptoJS.mode.GCM,
  padding: CryptoJS.pad.Pkcs7,
});

// BAD - Hardcoded key
const key = 'my-secret-key-123';

// GOOD - Derived key
const key = await crypto.subtle.deriveKey(
  { name: 'PBKDF2', salt, iterations: 100000, hash: 'SHA-256' },
  baseKey,
  { name: 'AES-GCM', length: 256 },
  false,
  ['encrypt', 'decrypt']
);

Logging (LOG)

RuleSeverityDescription
LOG001HighSensitive Data in Console Logs
LOG002LowConsole Logs in Production

Fix Example:

// BAD - Logging sensitive data
console.log('User password:', password);
console.log('Token:', authToken);

// GOOD - Redact sensitive data
console.log('User authenticated:', userId);
// Use conditional logging
if (process.env.NODE_ENV === 'development') {
  console.debug('Debug info:', data);
}

CI/CD Integration

GitHub Actions

name: Security Scan

on: [push, pull_request]

jobs:
  security:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4

      - name: Run Capsec Security Scan
        run: npx capsec scan --ci --output json --output-file security-report.json

      - name: Upload Security Report
        uses: actions/upload-artifact@v4
        if: always()
        with:
          name: security-report
          path: security-report.json

GitLab CI

security-scan:
  image: node:20
  script:
    - npx capsec scan --ci
  artifacts:
    reports:
      security: security-report.json
  only:
    - merge_requests
    - main

Configuration

capsec.config.json

{
  "exclude": [
    "**/node_modules/**",
    "**/dist/**",
    "**/*.test.ts",
    "**/*.spec.ts"
  ],
  "severity": "low",
  "categories": [],
  "rules": {
    "LOG002": {
      "enabled": false
    },
    "SEC001": {
      "severity": "critical"
    }
  }
}

Initialize Config

npx capsec init

Root/Jailbreak Detection

import { IsRoot } from '@capgo/capacitor-is-root';

async function checkDeviceSecurity() {
  const { isRooted } = await IsRoot.isRooted();

  if (isRooted) {
    // Option 1: Warn user
    showWarning('Device security compromised');

    // Option 2: Restrict features
    disableSensitiveFeatures();

    // Option 3: Block app (for high-security apps)
    blockApp();
  }
}

Security Checklist

Before Release

  • Run npx capsec scan --severity high
  • Remove all console.log statements
  • Disable WebView debugging
  • Remove development URLs
  • Verify no hardcoded secrets
  • Enable certificate pinning
  • Implement root/jailbreak detection
  • Add Content Security Policy
  • Use secure storage for credentials
  • Enable ProGuard (Android)
  • Verify ATS settings (iOS)

Ongoing

  • Run security scans in CI/CD
  • Monitor for new vulnerabilities
  • Update dependencies regularly
  • Review third-party plugins
  • Audit authentication flows

Resources

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.34%
按下载量换算642

Claude

28.29%
按下载量换算487

Cursor

18.25%
按下载量换算314

Gemini CLI

10.71%
按下载量换算184

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills