Security architecture and threat modeling. OWASP Top 10 2025 analysis, OWASP Agentic AI Top 10 (ASI01-ASI10), AI/LLM security patterns, supply chain security, modern API authentication (OAuth 2.1, DPoP, Passkeys/WebAuthn), vulnerability assessment, and security review for code and infrastructure.
Analyze threats using STRIDE:
| Threat | Description | Example | | -------------------------- | --------------------------- | --------------------- | | Spoofing | Impersonating users/systems | Stolen credentials | | Tampering | Modifying data | SQL injection | | Repudiation | Denying actions | Missing audit logs | | Information Disclosure | Data leaks | Exposed secrets | | Denial of Service | Blocking access | Resource exhaustion | | Elevation of Privilege | Gaining unauthorized access | Broken access control |
For AI/agentic systems, extend STRIDE with:
IMPORTANT: The OWASP Top 10 was updated in 2025 with two new categories and significant ranking shifts. Use this updated list, not the 2021 version.
| Rank | ID | Vulnerability | Key Change from 2021 | | ---- | --- | -------------------------------------- | ------------------------------------ | | 1 | A01 | Broken Access Control | Stable at #1; SSRF consolidated here | | 2 | A02 | Security Misconfiguration | Up from #5 | | 3 | A03 | Software Supply Chain Failures | NEW — replaces Vulnerable Components | | 4 | A04 | Cryptographic Failures | Down from #2 | | 5 | A05 | Injection | Down from #3 | | 6 | A06 | Insecure Design | Down from #4 | | 7 | A07 | Authentication Failures | Stable (renamed) | | 8 | A08 | Software or Data Integrity Failures | Stable | | 9 | A09 | Security Logging and Alerting Failures | Stable | | 10 | A10 | Mishandling of Exceptional Conditions | NEW |
Check for each vulnerability:
A01: Broken Access Control (includes SSRF from 2021)
A02: Security Misconfiguration (up from #5 — now #2, affects ~3% of tested apps)
A03: Software Supply Chain Failures (NEW — highest avg exploit/impact scores)
package-lock.json, yarn.lock, poetry.lock) and verify integritypostinstall scripts; disable or allowlist explicitlyA04: Cryptographic Failures (down from #2)
A05: Injection (down from #3)
A06: Insecure Design (down from #4)
A07: Authentication Failures
A08: Software or Data Integrity Failures
A09: Security Logging and Alerting Failures
A10: Mishandling of Exceptional Conditions (NEW)
When the codebase involves AI agents, LLMs, or autonomous systems, perform this additional assessment. Released December 2025 by OWASP GenAI Security Project.
| ASI | Risk | Core Attack Vector | | ----- | ---------------------------------- | ------------------------------------------------- | | ASI01 | Agent Goal Hijack | Prompt injection redirects agent objectives | | ASI02 | Tool Misuse | Legitimate tools abused beyond intended scope | | ASI03 | Identity & Privilege Abuse | Credential inheritance/delegation without scoping | | ASI04 | Supply Chain Vulnerabilities | Malicious tools, MCP servers, agent registries | | ASI05 | Unexpected Code Execution | Agent-generated code bypasses security controls | | ASI06 | Memory & Context Poisoning | Persistent corruption of agent memory/embeddings | | ASI07 | Insecure Inter-Agent Communication | Weak agent-to-agent protocol validation | | ASI08 | Cascading Failures | Error propagation across chained agents | | ASI09 | Human-Agent Trust Exploitation | Agents manipulate users into unsafe approvals | | ASI10 | Rogue Agents | Agents act outside authorized scope |
ASI01 — Agent Goal Hijack: Attackers manipulate planning logic via prompt injection in user input, RAG documents, emails, or calendar invites.
ASI02 — Tool Misuse: Agents use tools beyond intended scope (e.g., file deletion when only file read was authorized).
ASI03 — Identity & Privilege Abuse: Agents inherit or delegate credentials without proper scoping, creating attribution gaps.
ASI04 — Supply Chain Vulnerabilities (Agentic): Malicious MCP servers, agent cards, plugin registries, or tool packages poison the agent ecosystem.
ASI05 — Unexpected Code Execution: Agent-generated or "vibe-coded" code executes without traditional security controls (sandboxing, review).
ASI06 — Memory & Context Poisoning: Attackers embed malicious instructions in documents, web pages, or RAG corpora that persist in agent memory and influence future actions.
ASI07 — Insecure Inter-Agent Communication: Agent-to-agent messages lack authentication, integrity checks, or semantic validation, enabling injection attacks between agents.
ASI08 — Cascading Failures: Errors or attacks in one agent propagate uncontrolled through multi-agent pipelines.
ASI09 — Human-Agent Trust Exploitation: Agents present misleading information to manipulate users into approving unsafe actions.
ASI10 — Rogue Agents: Agents operate outside authorized scope, take unsanctioned actions, or resist human override.
Perform this check for all projects with external dependencies:
# Check for known vulnerabilities
npm audit --audit-level=high
# or
pnpm audit
# Verify lockfile integrity (ensure lockfile is committed and not bypassed)
# Check that package-lock.json / yarn.lock / pnpm-lock.yaml exists and is current
# Scan for malicious packages (behavioral analysis)
# Tools: Socket.dev, Snyk, Aikido, Safety (Python)
Dependency Confusion Defense:
@company/package-name)publishConfig and registry scoping to prevent public registry fallback for private packagesTyposquatting Defense:
npm install / pip install commands for misspellingsminimumReleaseAge) to allow malware detectionCI/CD Pipeline Hardening:
OAuth 2.1 (current standard — replaces OAuth 2.0 for new implementations):
OAuth 2.1 removes insecure grants:
- Implicit grant (response_type=token) — REMOVED: tokens in URL fragments leak
- Resource Owner Password Credentials (ROPC) — REMOVED: breaks delegated auth model
OAuth 2.1 mandates:
- PKCE (Proof Key for Code Exchange) for ALL authorization code flows
- Exact redirect URI matching (no wildcards)
- Sender-constraining tokens (DPoP recommended)
DPoP — Demonstrating Proof of Possession (RFC 9449):
// DPoP proof JWT structure (sent in DPoP header with each request)
// Header: { "typ": "dpop+jwt", "alg": "ES256", "jwk": { client_public_key } }
// Payload: { "jti": nonce, "htm": "POST", "htu": "https://api.example.com/token", "iat": timestamp }
// Signed with client private key — server verifies binding to issued token
Passkeys / WebAuthn (FIDO2) — for user-facing authentication:
navigator.credentials.create() (registration) and navigator.credentials.get() (authentication)// WebAuthn registration (simplified)
const credential = await navigator.credentials.create({
publicKey: {
challenge: serverChallenge, // random bytes from server
rp: { name: 'My App', id: 'myapp.example.com' },
user: { id: userId, name: userEmail, displayName: userName },
pubKeyCredParams: [{ alg: -7, type: 'public-key' }], // ES256
authenticatorSelection: { residentKey: 'preferred', userVerification: 'required' },
},
});
// Send credential.id and credential.response to server for verification
Look for common issues:
// BAD: SQL Injection
const query = `SELECT * FROM users WHERE id = ${userId}`;
// GOOD: Parameterized query
const query = `SELECT * FROM users WHERE id = $1`;
await db.query(query, [userId]);
// BAD: Hardcoded secrets
const apiKey = 'sk-abc123...';
// GOOD: Environment variables / secret manager
const apiKey = process.env.API_KEY;
// BAD: shell: true (shell injection vector)
const { exec } = require('child_process');
exec(`git commit -m "${userMessage}"`);
// GOOD: shell: false with array arguments
const { spawn } = require('child_process');
spawn('git', ['commit', '-m', userMessage], { shell: false });
// BAD: Fail open on error (dangerous for auth/authz)
try {
const isAuthorized = await checkPermission(user, resource);
if (isAuthorized) return next();
} catch (err) {
return next(); // WRONG: allows access on error
}
// GOOD: Fail securely (deny on error — A10:2025)
try {
const isAuthorized = await checkPermission(user, resource);
if (!isAuthorized) return res.status(403).json({ error: 'Forbidden' });
return next();
} catch (err) {
logger.error('Permission check failed', { err, user, resource });
return res.status(403).json({ error: 'Forbidden' }); // Default deny
}
Verify:
Create findings report:
## Security Assessment Report
### Critical Findings
1. SQL injection in /api/users endpoint
- Risk: Data breach
- Fix: Use parameterized queries
### High Findings
2. Missing rate limiting on login
- Risk: Brute force attacks
- Fix: Implement rate limiting
3. OAuth 2.0 implicit grant in use (deprecated)
- Risk: Access token exposure in URL fragments / browser history
- Fix: Migrate to Authorization Code + PKCE (OAuth 2.1)
### Medium Findings
4. No lockfile committed for npm dependencies
- Risk: Supply chain attack via dependency resolution drift
- Fix: Commit package-lock.json; add lockfile verification to CI
### Recommendations
- Enable HTTPS everywhere; enforce HSTS
- Implement CSP headers
- Add security logging for auth events
- Migrate to OAuth 2.1 (remove implicit/ROPC grants)
- Implement passkey/WebAuthn for phishing-resistant authentication
- Run `npm audit` / `pnpm audit` in CI with failure on high/critical
</execution_process>
<best_practices>
</best_practices> </instructions>
<examples> <usage_example> **Security Review Request**:Review the authentication flow in src/auth/ for security issues
Example Response:
## Security Review: src/auth/
### Findings
#### CRITICAL: Weak Password Hashing
- File: src/auth/password.js:23
- Issue: Using MD5 for password hashing
- Fix: Use bcrypt with cost factor >= 12
#### HIGH: No Rate Limiting
- File: src/auth/login.js
- Issue: Login endpoint has no rate limiting
- Fix: Add rate limiting (5 attempts/minute)
#### HIGH: OAuth 2.0 Implicit Grant in Use
- File: src/auth/oauth.js:45
- Issue: Using response_type=token (implicit grant, deprecated in OAuth 2.1)
- Fix: Migrate to Authorization Code flow with PKCE
#### MEDIUM: Session Not Invalidated
- File: src/auth/logout.js
- Issue: Logout doesn't invalidate server-side session
- Fix: Clear session from store on logout
### Recommendations
1. Implement bcrypt for password hashing (cost factor >= 12)
2. Add rate limiting middleware (5 req/min on /login)
3. Migrate OAuth flows to Authorization Code + PKCE (OAuth 2.1)
4. Consider passkeys/WebAuthn for phishing-resistant authentication
5. Use secure session configuration (HTTPOnly, Secure, SameSite=Strict)
</usage_example>
<usage_example> AI Agent Security Review Request:
Review the LLM agent pipeline in src/agents/ for agentic AI security risks
Example Response:
## Agentic AI Security Review: src/agents/
### ASI01 — Agent Goal Hijack (HIGH)
- File: src/agents/email-processor.js
- Issue: User email content passed directly to agent system prompt without sanitization
- Fix: Sanitize email content; enforce task boundary validation in routing layer
### ASI06 — Memory & Context Poisoning (HIGH)
- File: src/agents/memory-store.js:78
- Issue: Web-fetched content written to persistent memory without validation
- Fix: Validate and sanitize all external content before writing to memory; never
execute commands retrieved from memory without explicit human approval
### ASI02 — Tool Misuse (MEDIUM)
- File: src/agents/tools/file-tool.js
- Issue: Agent has both read and delete file permissions; delete scope too broad
- Fix: Split into read-only and write tools; apply least privilege per agent role
### ASI10 — Rogue Agent Risk (MEDIUM)
- Issue: No kill-switch or hard resource limits on agent execution
- Fix: Implement max-steps limit, timeout, and human override checkpoint for
operations affecting production data
</usage_example> </examples>
| Anti-Pattern | Why It Fails | Correct Approach | | ------------------------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | Approving code without full security review | Partial reviews miss exploitable paths in auth/PII/external data flows | Complete all STRIDE + OWASP phases before approving production deployment | | Using OWASP 2021 for AI/agentic systems | AI-specific threats (ASI01-ASI10) are not covered by the standard web list | Always run both OWASP Top 10 2025 and ASI01-ASI10 for any agentic component | | Failing open on security errors | Error paths become exploitable bypass conditions | Design every failure mode to deny access by default | | Providing vague remediation guidance | Developers cannot act without specifics | Provide exact code examples and parameterized fix patterns for every finding | | Missing severity prioritization | Critical findings are buried in noise with informational findings | Triage all findings as
<!-- Content truncated for initial SEO render. Open the source file tab for the full file. -->npx skills add oimiragieo/security-architect下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer