Unified Security Skill
Mission
Audit and harden codebases against real-world security failures, especially those introduced by fast AI-assisted development. Prioritize exploitable issues and provide concrete fixes.
Use When
- - Reviewing code for security vulnerabilities
- Implementing authentication, authorization, sessions, or access control
- Handling user input, file uploads, or external data
- Working with secrets, API keys, cryptography, or tokens
- Implementing payments, billing, or webhooks
- Configuring databases, RLS, or security rules
- Integrating AI/LLM services or agent tools
- Designing CI/CD workflows that invoke AI agents
- Evaluating dependency and supply chain risk
Core Principles
- 1. Never trust the client. Validate all critical data server-side.
- Defense in depth. Combine multiple controls.
- Fail closed. Missing config should disable access, not weaken it.
- Least privilege. Reduce access scope everywhere.
- Validate inputs and encode outputs for the render context.
Audit Workflow (adapt to stack)
- 1. Secrets and environment variables
- Database access control (RLS, rules, auth guards)
- Authentication and authorization
- Rate limiting and abuse prevention
- Payments and webhook validation
- Input validation and injection risks
- XSS, output encoding, CSP, and headers
- CSRF and session protections
- AI/LLM integration safety
- Deployment configuration and prod hardening
- Insecure defaults (fail-open config)
- Supply chain risk signals
- CI/CD agent action hardening
Immediate-Flag Patterns (Critical/High)
- - Secrets or service-role keys exposed client-side
- Client-controlled price, role, or access flags
- Disabled or overly permissive database rules
- Missing auth on privileged routes or APIs
- Hardcoded default credentials or weak crypto
- Unverified webhooks or signature bypasses
- Fail-open config that enables insecure operation
OWASP Top 10 (2025) Quick Map
- - A01 Broken Access Control: verify ownership and deny by default
- A02 Security Misconfiguration: harden defaults, disable unused features
- A03 Supply Chain Failures: lock versions and review dependencies
- A04 Cryptographic Failures: use modern algorithms and key management
- A05 Injection: parameterize queries, validate input
- A06 Insecure Design: threat model, rate limit, design controls
- A07 Auth Failures: MFA, secure sessions, breached-password checks
- A08 Integrity Failures: verify artifacts, use SRI, avoid unsafe deserialization
- A09 Logging Failures: log security events with alerting
- A10 Exception Handling: fail closed, hide internals, log context
ASVS 5.0 Highlights
- - Level 1: 12+ char passwords, auth rate limits, HTTPS everywhere
- Level 2: MFA for sensitive ops, encryption at rest, security logging
- Level 3: HSMs, formal threat modeling, pen test validation
Agentic AI Security (OWASP 2026) Summary
- - ASI01 Goal hijack: isolate and validate inputs
- ASI02 Tool misuse: restrict tools and verify I/O
- ASI03 Privilege abuse: short-lived scoped tokens
- ASI04 Supply chain: verify plugins and MCP servers
- ASI05 Code execution: sandbox, review, approvals
- ASI06 Memory poisoning: segment and validate context
- ASI07 Agent comms: authenticate and encrypt
- ASI08 Cascading failures: circuit breakers, isolation
- ASI09 Trust exploitation: verify high-risk outputs
- ASI10 Rogue agents: monitoring and kill switches
Insecure Defaults Detection
- - Fail-open is critical: INLINECODE0
- Fail-secure is acceptable:
SECRET = env['KEY'] (crashes if missing) - Ignore test fixtures, templates, and docs
- Verify runtime behavior before reporting
Supply Chain Risk Signals
Flag dependencies with one or more of:
- - Single maintainer or anonymous owner
- Unmaintained or archived status
- Low popularity compared to peers
- High-risk features (FFI, deserialization, code exec)
- History of critical CVEs
- No security contact or disclosure process
CI/CD Agent Actions Hardening
When workflows invoke AI agents, treat all event data as attacker-controlled.
Common AI action references:
- - INLINECODE2
- INLINECODE3
- INLINECODE4
- INLINECODE5
High-risk patterns:
- -
pull_request_target or issue_comment with untrusted input - Prompt fields populated via
env: intermediaries - Eval of AI output (
eval, exec, $()) - Dangerous sandbox configs (
danger-full-access, --yolo) - Wildcard allowlists (
allow-users: "*")
Safe defaults:
- - Restrict triggers to trusted contexts
- Strip or escape untrusted inputs before prompts
- Lock down tools and file access
- Use least-privileged tokens and permissions
- Require human approval for sensitive actions
Output Format
Organize findings by severity: Critical, High, Medium, Low.
For each issue:
- - File and line(s)
- Vulnerability name
- Concrete impact
- Before/after fix
End with a prioritized summary and remediation order.
When Generating Code
Use the same checks proactively. Prefer secure patterns by default and note tradeoffs in comments when you must relax controls.
When Generating a Security Audit Report
Save into the folder/project where this skill was executed as a markdown file with todays date
Final Report Format
CODEBLOCK0 diff
- vulnerable code
+ secure code
```
Recommendations
Clean Checks
Attribution and License
This skill is a curated, adapted work derived from:
- - https://github.com/raroque/vibe-security-skill (MIT)
- https://github.com/BehiSecc/VibeSec-Skill (Apache-2.0)
- https://github.com/agamm/claude-code-owasp (MIT)
- https://github.com/trailofbits/skills (CC-BY-SA-4.0)
This unified skill is licensed under CC-BY-SA-4.0 to satisfy ShareAlike requirements.
统一安全技能
使命
审计并加固代码库以防范真实世界的安全故障,特别是由快速AI辅助开发引入的问题。优先处理可被利用的问题并提供具体修复方案。
使用场景
- - 审查代码中的安全漏洞
- 实现身份验证、授权、会话或访问控制
- 处理用户输入、文件上传或外部数据
- 处理密钥、API密钥、加密或令牌
- 实现支付、计费或Webhook
- 配置数据库、行级安全或安全规则
- 集成AI/LLM服务或代理工具
- 设计调用AI代理的CI/CD工作流
- 评估依赖和供应链风险
核心原则
- 1. 永远不要信任客户端。在服务端验证所有关键数据。
- 纵深防御。结合多种控制措施。
- 故障安全关闭。缺失配置应禁用访问,而非削弱安全性。
- 最小权限。处处缩减访问范围。
- 验证输入并根据渲染上下文对输出进行编码。
审计工作流(适配技术栈)
- 1. 密钥和环境变量
- 数据库访问控制(行级安全、规则、认证守卫)
- 身份验证和授权
- 速率限制和滥用防护
- 支付和Webhook验证
- 输入验证和注入风险
- XSS、输出编码、内容安全策略和HTTP头
- CSRF和会话保护
- AI/LLM集成安全
- 部署配置和生产环境加固
- 不安全默认值(故障开放配置)
- 供应链风险信号
- CI/CD代理操作加固
立即标记模式(严重/高危)
- - 客户端暴露密钥或服务角色密钥
- 客户端控制的价格、角色或访问标志
- 禁用或过于宽松的数据库规则
- 特权路由或API缺少认证
- 硬编码的默认凭据或弱加密
- 未验证的Webhook或签名绕过
- 启用不安全操作的故障开放配置
OWASP Top 10(2025)快速映射
- - A01 访问控制失效:验证所有权并默认拒绝
- A02 安全配置错误:加固默认值,禁用未使用的功能
- A03 供应链故障:锁定版本并审查依赖
- A04 加密失效:使用现代算法和密钥管理
- A05 注入:参数化查询,验证输入
- A06 不安全设计:威胁建模、速率限制、设计控制
- A07 认证失效:多因素认证、安全会话、已泄露密码检查
- A08 完整性失效:验证工件、使用子资源完整性、避免不安全反序列化
- A09 日志记录失效:记录安全事件并设置告警
- A10 异常处理:故障安全关闭、隐藏内部信息、记录上下文
ASVS 5.0 要点
- - 第1级:12+字符密码、认证速率限制、全站HTTPS
- 第2级:敏感操作的多因素认证、静态加密、安全日志记录
- 第3级:硬件安全模块、正式威胁建模、渗透测试验证
代理AI安全(OWASP 2026)摘要
- - ASI01 目标劫持:隔离并验证输入
- ASI02 工具滥用:限制工具并验证输入/输出
- ASI03 权限滥用:短期作用域令牌
- ASI04 供应链:验证插件和MCP服务器
- ASI05 代码执行:沙箱、审查、审批
- ASI06 内存投毒:分段并验证上下文
- ASI07 代理通信:认证和加密
- ASI08 级联故障:断路器、隔离
- ASI09 信任利用:验证高风险输出
- ASI10 恶意代理:监控和终止开关
不安全默认值检测
- - 故障开放为严重:SECRET = env.get(KEY) or default
- 故障安全可接受:SECRET = env[KEY](缺失则崩溃)
- 忽略测试夹具、模板和文档
- 报告前验证运行时行为
供应链风险信号
标记具有以下一个或多个特征的依赖:
- - 单一维护者或匿名所有者
- 未维护或已归档状态
- 与同类相比流行度低
- 高风险功能(外部函数接口、反序列化、代码执行)
- 严重CVE历史记录
- 无安全联系人或披露流程
CI/CD代理操作加固
当工作流调用AI代理时,将所有事件数据视为攻击者可控。
常见AI操作引用:
- - anthropics/claude-code-action
- google-github-actions/run-gemini-cli
- openai/codex-action
- actions/ai-inference
高风险模式:
- - 使用不可信输入的pullrequesttarget或issue_comment
- 通过env:中介填充的提示字段
- AI输出的评估(eval、exec、$())
- 危险的沙箱配置(danger-full-access、--yolo)
- 通配符白名单(allow-users: *)
安全默认值:
- - 将触发器限制在可信上下文
- 在提示前剥离或转义不可信输入
- 锁定工具和文件访问
- 使用最小权限令牌和权限
- 敏感操作需要人工审批
输出格式
按严重程度组织发现:严重、高危、中危、低危。
每个问题包含:
以优先级摘要和修复顺序结束。
生成代码时
主动使用相同的检查。默认采用安全模式,在必须放宽控制时在注释中说明权衡。
生成安全审计报告时
保存到执行此技能的文件夹/项目中,以Markdown文件形式并包含当前日期
最终报告格式
安全审计报告
目标: <文件/组件>
日期: <今天>
审计人: <询问用户姓名> 或跳过并使用自动安全技能
执行摘要
<2-3句话:整体风险态势,最严重问题>
发现
[严重/高危/中危/低危] <标题>
- - 位置: 文件:行号
- 影响: ...
- 复现: ...
- 修复:
diff
- 漏洞代码
+ 安全代码
建议
<按优先级排序的行动项>
无问题项
<未发现问题的领域>
归属和许可
本技能是基于以下来源的策划改编作品:
- - https://github.com/raroque/vibe-security-skill (MIT)
- https://github.com/BehiSecc/VibeSec-Skill (Apache-2.0)
- https://github.com/agamm/claude-code-owasp (MIT)
- https://github.com/trailofbits/skills (CC-BY-SA-4.0)
本统一技能采用CC-BY-SA-4.0许可,以满足相同方式共享要求。