secure by whawkinsiv/claude-code-superpowers
npx skills add https://github.com/whawkinsiv/claude-code-superpowers --skill secure安全基础:
详细检查项请参见 COMMON-VULNS.md。
移至环境变量:
告知 AI:
将 API 密钥存储在 .env 文件中,而非代码中。
将 .env 添加到 .gitignore。
通过 process.env.API_KEY 访问。
最低要求:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
告知 AI:
添加身份验证:
- 使用 bcrypt 进行密码哈希处理(12 轮)
- 需要邮箱验证
- 会话超时:30 分钟
- 密码要求:8 个以上字符,1 个数字,1 个符号
实现细节请参见 SECURITY-PROMPTS.md。
始终加密:
切勿记录:
告知 AI:
切勿记录敏感数据。
在日志中用 "[REDACTED]" 替换密码/令牌。
所有 API 端点必需:
告知 AI:
添加到所有 API 路由:
- 需要有效的身份验证令牌
- 速率限制:每个 IP 每分钟 100 次请求
- 验证所有输入(拒绝无效输入)
- 通用错误信息(不向用户显示堆栈跟踪)
AI 构建应用中最常见:
检查方法请参见 COMMON-VULNS.md。
添加身份验证:
为此路由添加身份验证。
需要有效的 JWT 令牌。
如果缺失/无效则返回 401。
不要暴露错误详情。
速率限制:
添加速率限制:
- 每个 IP 每分钟 100 次请求
- 如果超过限制,返回 429 "请求过多"
- 使用滑动窗口,而非固定窗口
输入验证:
验证所有用户输入:
- 邮箱:有效格式
- 密码:8 个以上字符,1 个数字,1 个符号
- 用户名:仅限字母数字,3-20 个字符
用清晰的错误信息拒绝无效输入
更多提示请参见 SECURITY-PROMPTS.md。
部署前:
生产环境安全:
- [ ] 所有密钥都在环境变量中
- [ ] 强制使用 HTTPS(禁用 HTTP)
- [ ] 配置数据库备份
- [ ] 所有 API 实施速率限制
- [ ] 错误页面不显示堆栈跟踪
- [ ] 受保护的管理员路由
- [ ] 验证文件上传(类型、大小)
- [ ] 配置 CORS(不使用通配符 "*")
需要专家审查的迹象:
对于大多数 MVP: 遵循此清单已足够。
| 错误 | 修复方案 |
|---|---|
| API 密钥在代码中 | 移至 .env 文件 |
| 无速率限制 | 添加到所有端点 |
| 明文密码 | 使用 bcrypt |
| 生产环境使用 HTTP | 强制使用 HTTPS |
| 接受所有 CORS | 白名单域名 |
| 无输入验证 | 在服务器端验证 |
| 详细的错误信息 | 仅使用通用信息 |
简单的安全改进:
告知 AI:
添加 helmet.js 以设置安全头。
为生产环境配置(HTTPS、CSP、XSS 防护)。
快速检查:
暴露的密钥:
grep -r "api_key" src/
grep -r "password" src/
# 应该只找到对环境变量的引用
无身份验证绕过:
速率限制生效:
✅ 代码中无密钥(全部在 .env 中) ✅ 未经身份验证无法访问受保护路由 ✅ 密码已哈希处理,绝不存储明文 ✅ 速率限制防止滥用 ✅ 生产环境强制使用 HTTPS ✅ 在服务器端验证输入
每周安装量
120
代码库
GitHub 星标数
156
首次出现
2026年2月13日
安全审计
安装于
gemini-cli119
github-copilot119
codex119
amp119
cline119
kimi-cli119
Security Basics:
- [ ] Authentication required for protected routes
- [ ] Passwords hashed (bcrypt/argon2), never stored plain text
- [ ] API keys in environment variables, not code
- [ ] HTTPS only in production
- [ ] Input validated on server side
- [ ] SQL injection prevented (use parameterized queries)
- [ ] XSS prevented (sanitize user input)
- [ ] CSRF tokens on forms
- [ ] Rate limiting on API endpoints
- [ ] User sessions expire (30min-1hr typical)
See COMMON-VULNS.md for detailed checks.
Move to environment variables:
Tell AI:
Store API keys in .env file, not in code.
Add .env to .gitignore.
Access via process.env.API_KEY
Minimum requirements:
Tell AI:
Add authentication:
- bcrypt for password hashing (12 rounds)
- Email verification required
- Session timeout: 30 minutes
- Password requirements: 8+ chars, 1 number, 1 symbol
See SECURITY-PROMPTS.md for implementation details.
Always encrypt:
Never log:
Tell AI:
Never log sensitive data.
Replace passwords/tokens with "[REDACTED]" in logs.
Required for all API endpoints:
Tell AI:
Add to all API routes:
- Require valid auth token
- Rate limit: 100 requests/minute per IP
- Validate all inputs (reject invalid)
- Generic error messages (no stack traces to users)
Most common in AI-built apps:
See COMMON-VULNS.md for how to check.
Adding authentication:
Add authentication to this route.
Require valid JWT token.
Return 401 if missing/invalid.
Don't expose error details.
Rate limiting:
Add rate limiting:
- 100 requests/minute per IP
- Return 429 "Too many requests" if exceeded
- Use sliding window, not fixed
Input validation:
Validate all user inputs:
- Email: valid format
- Password: 8+ chars, 1 number, 1 symbol
- Username: alphanumeric only, 3-20 chars
Reject invalid input with clear error message
See SECURITY-PROMPTS.md for more.
Before deploying:
Production Security:
- [ ] All secrets in environment variables
- [ ] HTTPS enforced (no HTTP)
- [ ] Database backups configured
- [ ] Rate limiting on all APIs
- [ ] Error pages don't show stack traces
- [ ] Admin routes protected
- [ ] File uploads validated (type, size)
- [ ] CORS configured (not wildcard "*")
Signs you need expert review:
For most MVPs: Following this checklist is sufficient.
| Mistake | Fix |
|---|---|
| API keys in code | Move to .env |
| No rate limiting | Add to all endpoints |
| Plain text passwords | Use bcrypt |
| HTTP in production | Force HTTPS |
| Accepting all CORS | Whitelist domains |
| No input validation | Validate server-side |
| Detailed error messages | Generic messages only |
Easy security improvements:
Tell AI:
Add helmet.js for security headers.
Configure for production (HTTPS, CSP, XSS protection).
Quick checks:
Exposed secrets:
grep -r "api_key" src/
grep -r "password" src/
# Should only find references to env vars
No auth bypass:
Rate limiting works:
✅ No secrets in code (all in .env)
✅ Can't access protected routes without auth
✅ Passwords hashed, never stored plain text
✅ Rate limiting prevents abuse
✅ HTTPS enforced in production
✅ Input validated on server side
Weekly Installs
120
Repository
GitHub Stars
156
First Seen
Feb 13, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli119
github-copilot119
codex119
amp119
cline119
kimi-cli119
Azure RBAC 权限管理工具:查找最小角色、创建自定义角色与自动化分配
129,699 周安装