security-scan by jwynia/agent-skills
npx skills add https://github.com/jwynia/agent-skills --skill security-scan为代码库提供全面的安全漏洞检测。
/security-scan # 扫描当前目录
/security-scan --scope src/ # 扫描指定目录
/security-scan --quick # 快速扫描(仅关键问题)
/security-scan --focus injection # 专注于特定类别
分析代码中多个类别的安全漏洞:
对所有安全类别进行全面分析。
/security-scan
执行的检查:
持续时间: 2-5 分钟,取决于代码库大小
仅快速检查关键和高严重性问题。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
/security-scan --quick
执行的检查:
持续时间: 1 分钟以内
针对特定的漏洞类别。
/security-scan --focus <category>
类别:
injection - SQL、XSS、命令注入secrets - 凭据、API 密钥、令牌crypto - 加密弱点auth - 认证/授权问题config - 配置安全| 等级 | 图标 | 含义 | 所需操作 |
|---|---|---|---|
| CRITICAL | [!] | 可利用的漏洞 | 立即修复 |
| HIGH | [H] | 严重安全风险 | 部署前修复 |
| MEDIUM | [M] | 潜在漏洞 | 计划解决 |
| LOW | [L] | 次要问题或强化 | 考虑修复 |
| INFO | [i] | 信息性发现 | 仅作了解 |
[SEVERITY] CATEGORY: Brief description
File: path/to/file.ext:line
Pattern: What was detected
Risk: Why this is dangerous
Fix: How to remediate
SECURITY SCAN RESULTS
=====================
Scope: src/
Files scanned: 127
Duration: 45 seconds
FINDINGS BY SEVERITY
Critical: 2
High: 5
Medium: 12
Low: 8
TOP ISSUES
1. [!] SQL Injection in src/api/users.ts:45
2. [!] Hardcoded AWS key in src/config.ts:12
3. [H] XSS vulnerability in src/components/Comment.tsx:89
...
Run `/security-scan --details` for full report.
---|---|---
A01 | 失效的访问控制 | 授权模式分析
A02 | 加密机制失效 | 弱加密检测
A03 | 注入 | 模式匹配 + 数据流分析
A04 | 不安全设计 | 安全控制缺口
A05 | 安全配置错误 | 配置文件分析
A06 | 易受攻击的组件 | 依赖项扫描
A07 | 认证和授权失败 | 认证模式审查
A08 | 数据完整性失效 | 反序列化检查
A09 | 日志记录和监控不足 | 审计日志分析
A10 | 服务器端请求伪造 | 请求模式检测
每个类别的详细检测规则请参阅 references/owasp/。
SQL 注入:
- 查询中的字符串拼接
- 数据库调用中未经处理的用户输入
- 动态查询构建
跨站脚本攻击 (XSS):
- 使用用户数据进行的 innerHTML 赋值
- 使用动态内容的 document.write()
- 未转义的模板插值
命令注入:
- 使用用户输入的 exec()、system()、popen()
- Shell 命令字符串构建
- 未经处理的子进程参数
语言特定的模式请参阅 references/patterns/。
高置信度模式:
AWS Access Key: AKIA[0-9A-Z]{16}
AWS Secret Key: [A-Za-z0-9/+=]{40}
GitHub Token: gh[pousr]_[A-Za-z0-9]{36,}
Stripe Key: sk_live_[A-Za-z0-9]{24,}
Private Key: -----BEGIN (RSA |EC )?PRIVATE KEY-----
中等置信度模式:
Generic API Key: api[_-]?key.*[=:]\s*['"][a-zA-Z0-9]{16,}
Password in Code: password\s*[=:]\s*['"][^'"]+['"]
Connection String: (mysql|postgres|mongodb)://[^:]+:[^@]+@
弱算法:
- 使用 MD5 进行密码哈希
- 为安全目的使用 SHA1
- DES/3DES 加密
- RC4 流密码
实现问题:
- 硬编码的加密密钥
- 弱随机数生成
- 密码哈希中缺少盐值
- ECB 模式加密
/secrets-scan专注于凭据检测的深度分析:
/secrets-scan # 专门的密钥分析
/secrets-scan --entropy # 高熵字符串检测
/dependency-scan包漏洞分析:
/dependency-scan # 检查所有依赖项
/dependency-scan --fix # 在可能的情况下自动修复
/config-scan基础设施和配置审查:
/config-scan # 所有配置文件
/config-scan --docker # 容器安全
/config-scan --iac # 基础设施即代码
1. 识别项目类型(语言、框架)
2. 定位相关文件(源代码、配置、依赖项)
3. 确定适用的安全规则
1. 针对已知漏洞的模式匹配
2. 注入路径的数据流分析
3. 配置审查
1. 高置信度模式匹配
2. 潜在密钥的熵分析
3. Git 历史记录检查(可选)
1. 解析包清单
2. 根据漏洞数据库进行检查
3. 识别过时的包
1. 去重发现项
2. 分配严重性分数
3. 生成可操作的报告
4. 提供修复指导
在项目根目录创建 .security-scan.yaml:
# Scan configuration
scan:
exclude:
- "node_modules/**"
- "vendor/**"
- "**/*.test.ts"
- "**/__mocks__/**"
# Severity thresholds
thresholds:
fail_on: critical # critical, high, medium, low
warn_on: medium
# Category toggles
categories:
injection: true
secrets: true
crypto: true
auth: true
config: true
dependencies: true
# Custom patterns
patterns:
secrets:
- name: "Internal API Key"
pattern: "INTERNAL_[A-Z]{3}_KEY_[a-zA-Z0-9]{32}"
severity: high
创建 .security-scan-ignore 以处理误报:
# Ignore specific files
src/test/fixtures/mock-credentials.ts
# Ignore specific lines (use inline comment)
# security-scan-ignore: test fixture
const mockApiKey = "sk_test_fake123";
| 命令 | 描述 |
|---|---|
/security-scan | 完整安全扫描 |
/security-scan --quick | 仅关键问题 |
/security-scan --scope <path> | 扫描指定路径 |
/security-scan --focus <cat> | 单一类别 |
/security-scan --details | 详细输出 |
/security-scan --json | JSON 输出 |
/security-scan --fix | 在可能的情况下自动修复 |
/secrets-scan - 深度密钥检测/dependency-scan - 包漏洞分析/config-scan - 配置安全审查/review-code - 通用代码审查(包含安全方面)references/owasp/ - OWASP Top 10 检测详情references/patterns/ - 语言特定的漏洞模式references/remediation/ - 按漏洞类型提供的修复指导assets/severity-matrix.md - 严重性评分标准每周安装量
94
仓库
GitHub 星标数
37
首次出现
Feb 15, 2026
安全审计
安装于
codex86
github-copilot85
gemini-cli84
opencode84
kimi-cli81
amp81
Comprehensive security vulnerability detection for codebases.
/security-scan # Full scan of current directory
/security-scan --scope src/ # Scan specific directory
/security-scan --quick # Fast scan (critical issues only)
/security-scan --focus injection # Focus on specific category
Analyzes code for security vulnerabilities across multiple categories:
Comprehensive analysis of all security categories.
/security-scan
Checks performed:
Duration: 2-5 minutes depending on codebase size
Fast check for critical and high-severity issues only.
/security-scan --quick
Checks performed:
Duration: Under 1 minute
Target specific vulnerability category.
/security-scan --focus <category>
Categories:
injection - SQL, XSS, command injectionsecrets - Credentials, API keys, tokenscrypto - Cryptographic weaknessesauth - Authentication/authorization issuesconfig - Configuration security| Level | Icon | Meaning | Action Required |
|---|---|---|---|
| CRITICAL | [!] | Exploitable vulnerability | Immediate fix |
| HIGH | [H] | Serious security risk | Fix before deploy |
| MEDIUM | [M] | Potential vulnerability | Plan to address |
| LOW | [L] | Minor issue or hardening | Consider fixing |
| INFO |
[SEVERITY] CATEGORY: Brief description
File: path/to/file.ext:line
Pattern: What was detected
Risk: Why this is dangerous
Fix: How to remediate
SECURITY SCAN RESULTS
=====================
Scope: src/
Files scanned: 127
Duration: 45 seconds
FINDINGS BY SEVERITY
Critical: 2
High: 5
Medium: 12
Low: 8
TOP ISSUES
1. [!] SQL Injection in src/api/users.ts:45
2. [!] Hardcoded AWS key in src/config.ts:12
3. [H] XSS vulnerability in src/components/Comment.tsx:89
...
Run `/security-scan --details` for full report.
---|---|---
A01 | Broken Access Control | Authorization pattern analysis
A02 | Cryptographic Failures | Weak crypto detection
A03 | Injection | Pattern matching + data flow
A04 | Insecure Design | Security control gaps
A05 | Security Misconfiguration | Config file analysis
A06 | Vulnerable Components | Dependency scanning
A07 | Auth Failures | Auth pattern review
A08 | Data Integrity Failures | Deserialization checks
A09 | Logging Failures | Audit log analysis
A10 | SSRF | Request pattern detection
See references/owasp/ for detailed detection rules per category.
SQL Injection:
- String concatenation in queries
- Unsanitized user input in database calls
- Dynamic query construction
Cross-Site Scripting (XSS):
- innerHTML assignments with user data
- document.write() with dynamic content
- Unescaped template interpolation
Command Injection:
- exec(), system(), popen() with user input
- Shell command string construction
- Unsanitized subprocess arguments
See references/patterns/ for language-specific patterns.
High-Confidence Patterns:
AWS Access Key: AKIA[0-9A-Z]{16}
AWS Secret Key: [A-Za-z0-9/+=]{40}
GitHub Token: gh[pousr]_[A-Za-z0-9]{36,}
Stripe Key: sk_live_[A-Za-z0-9]{24,}
Private Key: -----BEGIN (RSA |EC )?PRIVATE KEY-----
Medium-Confidence Patterns:
Generic API Key: api[_-]?key.*[=:]\s*['"][a-zA-Z0-9]{16,}
Password in Code: password\s*[=:]\s*['"][^'"]+['"]
Connection String: (mysql|postgres|mongodb)://[^:]+:[^@]+@
Weak Algorithms:
- MD5 for password hashing
- SHA1 for security purposes
- DES/3DES encryption
- RC4 stream cipher
Implementation Issues:
- Hardcoded encryption keys
- Weak random number generation
- Missing salt in password hashing
- ECB mode encryption
/secrets-scanFocused deep-dive on credential detection:
/secrets-scan # Dedicated secrets analysis
/secrets-scan --entropy # High-entropy string detection
/dependency-scanPackage vulnerability analysis:
/dependency-scan # Check all dependencies
/dependency-scan --fix # Auto-fix where possible
/config-scanInfrastructure and configuration review:
/config-scan # All config files
/config-scan --docker # Container security
/config-scan --iac # Infrastructure as Code
1. Identify project type (languages, frameworks)
2. Locate relevant files (source, config, dependencies)
3. Determine applicable security rules
1. Pattern matching for known vulnerabilities
2. Data flow analysis for injection paths
3. Configuration review
1. High-confidence pattern matching
2. Entropy analysis for potential secrets
3. Git history check (optional)
1. Parse package manifests
2. Check against vulnerability databases
3. Identify outdated packages
1. Deduplicate findings
2. Assign severity scores
3. Generate actionable report
4. Provide remediation guidance
Create .security-scan.yaml in project root:
# Scan configuration
scan:
exclude:
- "node_modules/**"
- "vendor/**"
- "**/*.test.ts"
- "**/__mocks__/**"
# Severity thresholds
thresholds:
fail_on: critical # critical, high, medium, low
warn_on: medium
# Category toggles
categories:
injection: true
secrets: true
crypto: true
auth: true
config: true
dependencies: true
# Custom patterns
patterns:
secrets:
- name: "Internal API Key"
pattern: "INTERNAL_[A-Z]{3}_KEY_[a-zA-Z0-9]{32}"
severity: high
Create .security-scan-ignore for false positives:
# Ignore specific files
src/test/fixtures/mock-credentials.ts
# Ignore specific lines (use inline comment)
# security-scan-ignore: test fixture
const mockApiKey = "sk_test_fake123";
| Command | Description |
|---|---|
/security-scan | Full security scan |
/security-scan --quick | Critical issues only |
/security-scan --scope <path> | Scan specific path |
/security-scan --focus <cat> | Single category |
/security-scan --details | Verbose output |
/security-scan --json |
/secrets-scan - Deep secrets detection/dependency-scan - Package vulnerability analysis/config-scan - Configuration security review/review-code - General code review (includes security)references/owasp/ - OWASP Top 10 detection detailsreferences/patterns/ - Language-specific vulnerability patternsreferences/remediation/ - Fix guidance by vulnerability typeassets/severity-matrix.md - Severity scoring criteriaWeekly Installs
94
Repository
GitHub Stars
37
First Seen
Feb 15, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex86
github-copilot85
gemini-cli84
opencode84
kimi-cli81
amp81
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
43,100 周安装
[i] |
| Informational finding |
| Awareness only |
| JSON output |
/security-scan --fix | Auto-fix where possible |