Loading...
Loading...
Compare original and translation side by side
| Rank | Vulnerability | Prevention |
|---|---|---|
| A01 | Broken Access Control | Check permissions server-side, deny by default |
| A02 | Cryptographic Failures | Use TLS, hash passwords, encrypt sensitive data |
| A03 | Injection | Parameterized queries, validate input |
| A04 | Insecure Design | Threat modeling, secure defaults |
| A05 | Security Misconfiguration | Harden configs, disable unused features |
| A06 | Vulnerable Components | Update dependencies, audit regularly |
| A07 | Auth Failures | MFA, rate limiting, secure session management |
| A08 | Data Integrity Failures | Verify signatures, use trusted sources |
| A09 | Logging Failures | Log security events, protect logs |
| A10 | SSRF | Validate URLs, allowlist destinations |
| 排名 | 漏洞类型 | 预防措施 |
|---|---|---|
| A01 | 访问控制失效 | 在服务器端检查权限,默认拒绝所有请求 |
| A02 | 加密机制失败 | 使用TLS,哈希密码,加密敏感数据 |
| A03 | 注入攻击 | 使用参数化查询,验证输入 |
| A04 | 不安全设计 | 进行威胁建模,采用安全默认配置 |
| A05 | 安全配置错误 | 加固配置,禁用未使用功能 |
| A06 | 易受攻击的组件 | 定期更新依赖项,进行审计 |
| A07 | 身份认证失败 | 启用多因素认证(MFA),设置速率限制,安全管理会话 |
| A08 | 数据完整性失败 | 验证签名,使用可信数据源 |
| A09 | 日志记录失败 | 记录安全事件,保护日志数据 |
| A10 | SSRF | 验证URL,使用白名单指定目标地址 |
undefinedundefinedundefinedundefinedAlways validate:
- Type (string, int, email format)
- Length (min/max bounds)
- Range (numeric bounds)
- Format (regex for patterns)
- Allowlist (known good values)
Never trust:
- URL parameters
- Form data
- HTTP headers
- Cookies
- File uploads始终要验证:
- 类型(字符串、整数、邮箱格式)
- 长度(最小/最大限制)
- 范围(数值边界)
- 格式(使用正则匹配模式)
- 白名单(已知合法值)
绝不要信任:
- URL参数
- 表单数据
- HTTP请求头
- Cookie
- 文件上传// WRONG - Direct HTML insertion
element.innerHTML = userInput;
// CORRECT - Text content (auto-escapes)
element.textContent = userInput;
// CORRECT - Template with escaping
render(`<div>${escapeHtml(userInput)}</div>`);// WRONG - Direct HTML insertion
element.innerHTML = userInput;
// CORRECT - Text content (auto-escapes)
element.textContent = userInput;
// CORRECT - Template with escaping
render(`<div>${escapeHtml(userInput)}</div>`);| Context | Encoding |
|---|---|
| HTML body | HTML entity encode |
| HTML attribute | Attribute encode + quote |
| JavaScript | JS encode |
| URL parameter | URL encode |
| CSS | CSS encode |
| 场景 | 编码方式 |
|---|---|
| HTML主体 | HTML实体编码 |
| HTML属性 | 属性编码+引号包裹 |
| JavaScript | JS编码 |
| URL参数 | URL编码 |
| CSS | CSS编码 |
undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedDO:
- Use environment variables or secrets manager
- Rotate secrets regularly
- Use different secrets per environment
- Audit secret access
DON'T:
- Commit secrets to git
- Log secrets
- Include secrets in error messages
- Share secrets in plain text应当:
- 使用环境变量或密钥管理工具
- 定期轮换密钥
- 不同环境使用不同密钥
- 审计密钥访问记录
禁止:
- 将密钥提交到git仓库
- 记录密钥信息
- 在错误信息中包含密钥
- 明文分享密钥Content-Security-Policy: default-src 'self'; script-src 'self'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Strict-Transport-Security: max-age=31536000; includeSubDomains
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: geolocation=(), camera=()Content-Security-Policy: default-src 'self'; script-src 'self'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Strict-Transport-Security: max-age=31536000; includeSubDomains
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: geolocation=(), camera=()undefinedundefinedundefinedundefined./references/owasp-detailed.md./references/auth-patterns.md./references/crypto-patterns.md./references/secure-headers.md./references/owasp-detailed.md./references/auth-patterns.md./references/crypto-patterns.md./references/secure-headers.md./scripts/security-scan.sh./scripts/dependency-audit.sh./scripts/security-scan.sh./scripts/dependency-audit.sh