一键导入
security-patterns
Universal security patterns based on OWASP Top 10 and security best practices. Framework-agnostic security guidance.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Universal security patterns based on OWASP Top 10 and security best practices. Framework-agnostic security guidance.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Compressed-prose response style for the orchestrator (opt-in via behavior.caveman_mode). Drops articles, fillers, and transitional prose; preserves code, paths, JSON/TOML, and quoted text verbatim.
Maestro project patterns — Rust CLI with ratatui TUI, tokio async, Claude CLI process management, and stream-json parsing.
TEMPLATE - Backend API development patterns. Copy and customize for your backend framework (Express, Django, Spring Boot, FastAPI, etc.)
TEMPLATE - Frontend web development patterns. Copy and customize for your frontend framework (React, Vue, Angular, Svelte, etc.)
Defensive patterns for GitHub (gh) and Azure DevOps (az) CLI interactions — error handling, idempotency, rate limits, missing resources.
API contract validation patterns for ensuring client-side models match backend JSON responses. Prevents decoding failures from schema mismatches. Tech-stack agnostic.
| name | security-patterns |
| version | 1.0.0 |
| description | Universal security patterns based on OWASP Top 10 and security best practices. Framework-agnostic security guidance. |
| allowed-tools | Read, Grep, Glob, WebSearch |
Universal security patterns and OWASP Top 10 compliance. Framework-agnostic security guidance.
| Aspect | Details |
|---|---|
| Consumer | subagent-security-analyst (and all architects) |
| Purpose | Security vulnerability detection and remediation patterns |
| Invocation | Subagents read this skill; NOT directly invocable by users |
| Applicability | All frameworks and languages |
| # | Vulnerability | Description | Prevention |
|---|---|---|---|
| A01 | Broken Access Control | Missing or improper authorization | Implement proper access controls, deny by default |
| A02 | Cryptographic Failures | Weak encryption, exposed secrets | Use strong encryption, protect data at rest/transit |
| A03 | Injection | SQL, NoSQL, Command injection | Use parameterized queries, ORM, input validation |
| A04 | Insecure Design | Missing security requirements | Apply threat modeling, secure design patterns |
| A05 | Security Misconfiguration | Default configs, verbose errors | Harden configs, disable debug in production |
| A06 | Vulnerable Components | Outdated dependencies | Keep dependencies updated, scan for CVEs |
| A07 | Auth/Session Issues | Weak authentication | Use MFA, secure session management, strong passwords |
| A08 | Data Integrity Failures | Unsigned/unverified data | Implement digital signatures, integrity checks |
| A09 | Logging Failures | Insufficient logging | Log security events, monitor anomalies |
| A10 | SSRF | Server-side request forgery | Validate URLs, use allowlists, network segmentation |
ALWAYS validate and sanitize user input:
1. Validate type, length, format, range
2. Use allowlist (not denylist) when possible
3. Sanitize before processing or storing
4. Encode before rendering (prevent XSS)
Best practices:
1. Never store passwords in plaintext
2. Use bcrypt, scrypt, or Argon2 for hashing
3. Implement account lockout after failed attempts
4. Use MFA where possible
5. Secure password reset flows
Implement principle of least privilege:
1. Check permissions on EVERY request
2. Use role-based access control (RBAC)
3. Deny by default
4. Validate on server-side (never trust client)
1. Use parameterized queries/prepared statements
2. Use ORMs with proper escaping
3. Never concatenate user input into queries
4. Apply principle of least privilege to DB users
1. Escape output based on context (HTML, JS, CSS, URL)
2. Use Content Security Policy (CSP) headers
3. Sanitize HTML if allowing user HTML
4. Use frameworks that auto-escape by default
1. Use anti-CSRF tokens
2. Validate token on state-changing requests
3. Use SameSite cookie attribute
4. Verify Origin/Referer headers
For complete implementation details, read:
Content-Security-Policy: default-src 'self'
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: geolocation=(), microphone=()
Strict-Transport-Security: max-age=31536000; includeSubDomains
// Helmet for security headers
const helmet = require('helmet')
app.use(helmet())
// Rate limiting
const rateLimit = require('express-rate-limit')
app.use(rateLimit({ windowMs: 15 * 60 * 1000, max: 100 }))
// Parameterized queries
db.query('SELECT * FROM users WHERE id = $1', [userId])
# Django has many security features built-in:
# - CSRF protection (middleware)
# - XSS protection (template auto-escaping)
# - SQL injection protection (ORM)
# Ensure these settings:
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
// Spring Security configuration
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().and()
.headers()
.contentSecurityPolicy("default-src 'self'");
}
}