请通过私有渠道报告安全问题,邮件:1007372080@qq.com。不要在公开 Issue、PR 或讨论区披露可利用细节。
- 不提交
.env、Tushare token、GitHub token、商业行情数据或私有研究产物。 .env已在.gitignore中,示例值只放在.env.example。- CI 密钥通过 GitHub Actions Secrets 注入,不能写进 workflow、源码、文档或测试快照。
- 不把 token 写进
git remoteURL。优先使用 Git Credential Manager、系统凭据助手或gh auth。
提交或开源前建议执行脱敏检查:
git status --short
git grep -n "TUSHARE_[T]OKEN\|g[h]p_\|github_[p]at_\|FACTORZEN_LLM_[A]PI_KEY" -- . ':!.env.example'检查 remote URL 是否嵌入凭据时,不要把 URL 原文贴到 Issue 或日志里,只输出布尔结果:
url=$(git remote get-url origin)
case "$url" in
*://*@*) echo 'origin-has-embedded-credential' ;;
*) echo 'origin-clean' ;;
esac如果 token 曾出现在本地配置、remote URL、日志、聊天记录、提交历史或第三方服务中,按泄露处理:
-
在对应平台吊销旧 token。
-
创建最小权限的新 token。
-
清理本地 remote URL,例如:
git remote set-url origin https://github.com/rookiewu417/FactorZen.git
-
更新本机凭据助手或 GitHub Actions Secrets。
-
用上面的脱敏检查确认仓库内容不含明文凭据。
条件允许时,对 main / master 启用分支保护:必须通过 CI、禁止直接推送、敏感变更需要 PR 审查。