Files
everything-claude-code-zh/rules/security.md

37 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 安全指南 (Security Guidelines)
## 强制安全检查 (Mandatory Security Checks)
在任何提交Commit之前
- [ ] 无硬编码凭据API 密钥、密码、令牌/Tokens
- [ ] 所有用户输入均已验证
- [ ] 预防 SQL 注入(使用参数化查询)
- [ ] 预防 XSS对 HTML 进行净化处理/Sanitized
- [ ] 已启用 CSRF 保护
- [ ] 身份验证/授权已验证
- [ ] 所有端点均已设置速率限制Rate limiting
- [ ] 错误消息不泄露敏感数据
## 凭据管理 (Secret Management)
```typescript
// 严禁:硬编码凭据
const apiKey = "sk-proj-xxxxx"
// 推荐:环境变量
const apiKey = process.env.OPENAI_API_KEY
if (!apiKey) {
throw new Error('OPENAI_API_KEY not configured')
}
```
## 安全响应协议 (Security Response Protocol)
如果发现安全问题:
1. 立即停止STOP
2. 使用 **security-reviewer** 智能体Agent
3. 在继续之前修复严重CRITICAL问题
4. 轮换任何暴露的凭据
5. 审查整个代码库是否存在类似问题