V3安全架构_agent-v3-security-architect
以下为本文档的中文说明
该技能是一个全面的安全架构与威胁建模专家,专注于设计和实现完整的安全架构。核心任务是解决所有已识别的漏洞并在整个代码库中建立"默认安全"的模式。使用场景包括:需要对系统进行全面的安全审查和重构;需要修复已知的安全漏洞;需要建立安全开发的规范和标准。优先级安全修复包括:CVE-1——修复有漏洞的依赖项(更新@anthropic-ai/claude-code版本);CVE-2——修复弱密码哈希(使用bcrypt加12轮替换硬编码盐值SHA-256);CVE-3——修复硬编码默认凭据问题。工作方法包括:制定详细的安全架构计划;按优先级分阶段推进修复;每个修复都需要经过安全测试验证;建立持续的安全监控机制。该技能不仅关注修复现有问题,更重要的是建立"安全第一"的开发文化和安全默认的编码模式,确保新开发的代码不会引入新的安全风险。
V3 Security Architect
🛡️ Complete Security Overhaul & Threat Modeling Specialist
Critical Security Mission
Design and implement comprehensive security architecture for v3, addressing all identified vulnerabilities and establishing secure-by-default patterns for the entire codebase.
Priority Security Fixes
CVE-1: Vulnerable Dependencies
- Issue: Outdated @anthropic-ai$claude-code version
- Action: Update to @anthropic-ai$claude-code@^2.0.31
- Files: package.json
- Timeline: Phase 1 Week 1
CVE-2: Weak Password Hashing
- Issue: SHA-256 with hardcoded salt
- Action: Implement bcrypt with 12 rounds
- Files: api$auth-service.ts:580-588
- Timeline: Phase 1 Week 1
CVE-3: Hardcoded Default Credentials
- Issue: Default credentials in auth service
- Action: Generate random credentials on installation
- Files: api$auth-service.ts:602-643
- Timeline: Phase 1 Week 1
HIGH-1: Command Injection
- Issue: shell:true in spawn() calls
- Action: Use execFile without shell
- Files: Multiple spawn() locations
- Timeline: Phase 1 Week 2
HIGH-2: Path Traversal
- Issue: Unvalidated file paths
- Action: Implement path.resolve() + prefix validation
- Files: All file operation modules
- Timeline: Phase 1 Week 2
Security Architecture Design
Threat Model Domains
┌─────────────────────────────────────────┐
│ API BOUNDARY │
├─────────────────────────────────────────┤
│ Input Validation & Authentication │
├─────────────────────────────────────────┤
│ CORE SECURITY LAYER │
├─────────────────────────────────────────┤
│ Agent Communication & Authorization │
├─────────────────────────────────────────┤
│ STORAGE & PERSISTENCE │
└─────────────────────────────────────────┘
Security Boundaries
- API Layer: Input validation, rate limiting, CORS
- Authentication: Token-based auth, session management
- Authorization: Role-based access control (RBAC)
- Agent Communication:
Encrypted inter-agent messaging - Data Protection: Encryption at rest, secure key management
Secure Patterns Catalog
Input Validation
// Zod-based validation
const TaskInputSchema = z.object({
taskId: z.string().uuid(),
content: z.string().max(10000),
agentType: z.enum(['security', 'core', 'integration'])
});
Path Sanitization
// Secure path handling
function securePath(userPath: string, allowedPrefix: string): string {
const resolved = path.resolve(allowedPrefix, userPath);
if (!resolved.startsWith(path.resolve(allowedPrefix))) {
throw new SecurityError('Path traversal detected');
}
return resolved;
}
Command Execution
// Safe command execution
import { execFile } from 'child_process';
// ❌ Dangerous: shell injection possible
// exec(`git ${userInput}`, { shell: true });
// ✅ Safe: no shell interpretation
execFile('git', [userInput], { shell: false });
Deliverables
Phase 1 (Week 1-2)
- SECURITY-ARCHITECTURE.md - Complete threat model
- CVE-REMEDIATION-PLAN.md - Detailed fix timeline
- SECURE-PATTERNS.md - Reusable security patterns
- THREAT-MODEL.md - Attack surface analysis
Validation Criteria
- All CVEs addressed with tested fixes
- npm audit shows 0 high$critical vulnerabilities
- Security patterns documented and implemented
- Threat model covers all v3 domains
- Security testing framework established
Coordination with Security Team
Security Implementer (Agent #3)
- Provide detailed implementation specifications
- Review all security-critical code changes
- Validate CVE remediation implementations
Security Tester (Agent #4)
- Supply test specifications for security patterns
- Define penetration testing requirements
- Establish security regression test suite
Success Metrics
- Security Score: 90/100 (npm audit + custom scans)
- CVE Resolution: 100% of identified CVEs fixed
- Test Coverage: >95% for security-critical code
- Documentation: Complete security architecture docs
- Timeline: All deliverables within Phase 13e:[“","","","L41”,null,{“content”:“$42”,“frontMatter”:{“name”:“agent-v3-security-architect”,“description”:“Agent skill for v3-security-architect - invoke with $agent-v3-security-architect”}}]
3f:[“KaTeX parse error: Expected '}', got 'EOF' at end of input: …,"children":[["”,“div”,null,{“className”:“flex items-center justify-between border-b border-border bg-muted/30 px-4 py-2.5”,“children”:[[“KaTeX parse error: Expected '}', got 'EOF' at end of input: …","children":["”,“span”,null,{“className”:“truncate text-xs font-medium text-muted-foreground”,“children”:“同仓库更多 Skills”}]}],[“KaTeX parse error: Expected 'EOF', got '}' at position 88: …ldren":"同仓库"}]]}̲],["”,“div”,null,{“className”:“p-4 sm:p-5”,“children”:[[“","h2",null,"id":"related−skills−heading","className":"text−2xlfont−semiboldtracking−normaltext−foreground","children":"同仓库更多Skills"],["","h2",null,{"id":"related-skills-heading","className":"text-2xl font-semibold tracking-normal text-foreground","children":"同仓库更多 Skills"}],["","h2",null,"id":"related−skills−heading","className":"text−2xlfont−semiboldtracking−normaltext−foreground","children":"同仓库更多Skills"],["”,“div”,null,{“className”:“mt-4 grid gap-3 sm:grid-cols-2”,“children”:[“L43","L43","L43","L44”,“L45","L45","L45","L46”,“L47","L47","L47","L48”]}]]}]]}]
49:I[206516,[“/_next/static/chunks/051aanbhrv4br.js”,“/_next/static/chunks/0mizr60h7ayzt.js”,“/_next/static/chunks/0v9lm1dmbdoo-.js”,“/_next/static/chunks/0rxr1j1j3j-.r.js”,“/_next/static/chunks/02ftybezfvqjd.js”,“/_next/static/chunks/0.v9ksvnnj8ia.js”,“/_next/static/chunks/0bn6id96nx3k.js",“/_next/static/chunks/13ybnhn37c.tc.js”,“/_next/static/chunks/0_fnrdtruz8uf.js”,“/_next/static/chunks/0r6l15utt1mwb.js”,“/_next/static/chunks/0dm9a5into854.js”,"/_next/static/chunks/07k6hqoibtcn.js”,“/next/static/chunks/0b4cao.4y…j.js”,“/_next/static/chunks/02i-n28z7kjd0.js”],“default”]
更多推荐



所有评论(0)