安全Medium心

Security guidelines and actionable protection checklist for high-privilege agents

API Key Security

Storage Best Practices

  • ✅ Store API keys in environment variables
  • ✅ Never hardcode keys in code or config files
  • ✅ Use .env.local and add to .gitignore
  • ❌ 不要在日志Medium输出 Key
  • ❌ 不要在截图Medium暴露 Key

Rotation & Limits

  • • Rotate API keys regularly (every 90 days recommended)
  • • Set usage limits and alerts
  • • Use read-only keys when possible
Minimal Permissions

安装 Skill 前,仔细阅读权限说明:

Low Risk
  • • 文件读取
  • • 网络请求
Medium Risk
  • • 文件写入
  • • 系统命令
  • • 浏览器控制
High Risk
  • • 支付操作
  • • 删除数据
  • • 发货/发布
Cloud Deployment安全
  • ✅ 使用 SSH Key 认证,禁用密码登录
  • ✅ 配置防火墙,只开放必要端口
  • ✅ 使用反向代理(Nginx/Caddy)
  • ✅ 启用 HTTPS(Let's Encrypt)
  • ✅ 定期更新系统和依赖
  • ✅ 配置日志脱敏
常见风险案例

案例 1:API Key 泄露

Development者在 GitHub 提交了包含 OpenAI API Key 的配置文件,导致 Key 被爬虫抓取并滥用。

防护:使用 .env.local + .gitignore,定期扫描仓库历史

案例 2:权限滥用

某 Skill 声称"只读文件",实际执行了删除操作。

防护:审查 Skill 源码,使用沙箱环境测试