|
| 1 | +# TODO & Work Session Log |
| 2 | + |
| 3 | +## 2026-04-15: Git 历史敏感信息清理与远程仓库配置 |
| 4 | + |
| 5 | +### 已完成任务 |
| 6 | + |
| 7 | +#### 1. 敏感信息检查与清理 |
| 8 | +- ✅ 检查 Git 历史记录中的敏感信息 |
| 9 | +- ✅ 发现真实代理服务器密码:`a3fae92f-dee0-4807-9363-739f8090df7e` |
| 10 | +- ✅ 发现代理服务器地址:`abondon.hefnfnwbbsbehgshes.com` |
| 11 | +- ✅ 使用 `git filter-branch` 从历史中清除敏感文件 |
| 12 | +- ✅ 清理 Git 备份引用和垃圾回收 |
| 13 | +- ✅ 验证敏感信息已完全清除 |
| 14 | + |
| 15 | +**清除的文件:** |
| 16 | +- `src/assets/DuangCloud-Config.js` |
| 17 | +- `src/assets/duangcloud-rules.js` |
| 18 | + |
| 19 | +**保留的文件:** |
| 20 | +- 测试文件中的测试密码(test-password, test)- 安全 |
| 21 | +- VPN-Server 配置文件 - 从未被提交过 |
| 22 | + |
| 23 | +#### 2. 远程仓库配置 |
| 24 | +- ✅ 添加远程仓库:`git@github.com:Kane-Kuroneko/clash-extend-scripts.git` |
| 25 | +- ✅ 推送 master 分支到远端 |
| 26 | +- ✅ 设置上游分支跟踪 |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +### 待处理任务 |
| 31 | + |
| 32 | +#### 🔲 私有配置文件管理方案 |
| 33 | + |
| 34 | +**需求:** |
| 35 | +- 将敏感文件(VPN 配置等)存储到仓库中但对公众不可见 |
| 36 | +- 实现自动化私有文件的版本控制 |
| 37 | + |
| 38 | +**考虑的方案:** |
| 39 | + |
| 40 | +1. **GitHub Secrets + GitHub Actions(推荐)** |
| 41 | + - 将配置文件编码为 Base64 存储在 GitHub Secrets 中 |
| 42 | + - 使用 GitHub Actions 工作流在 CI/CD 时解码并生成文件 |
| 43 | + - 优点:完全私有、自动化、安全 |
| 44 | + - 注意:单个 Secret 限制 64 KB |
| 45 | + |
| 46 | +2. **Git Submodule** |
| 47 | + - 创建私有仓库存储敏感文件 |
| 48 | + - 在公开仓库中通过 submodule 引用 |
| 49 | + - 优点:完全隔离、可控访问权限 |
| 50 | + - 缺点:需要维护两个仓库 |
| 51 | + |
| 52 | +3. **加密存储(git-crypt / SOPS)** |
| 53 | + - 加密敏感文件后提交到仓库 |
| 54 | + - 有密钥的人才能查看 |
| 55 | + - 优点:文件在仓库中但已加密 |
| 56 | + - 缺点:需要管理加密密钥 |
| 57 | + |
| 58 | +**下一步行动:** |
| 59 | +- [ ] 确认配置文件大小 |
| 60 | +- [ ] 选择最终方案 |
| 61 | +- [ ] 实施选定的方案 |
| 62 | +- [ ] 创建 GitHub Actions 工作流(如选择方案 1) |
| 63 | +- [ ] 测试自动化流程 |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +### 技术笔记 |
| 68 | + |
| 69 | +#### Git 历史清理命令 |
| 70 | +```bash |
| 71 | +# 使用 filter-branch 删除文件 |
| 72 | +git filter-branch --force --index-filter \ |
| 73 | + 'git rm --cached --ignore-unmatch <file-path>' \ |
| 74 | + --prune-empty --tag-name-filter cat -- --all |
| 75 | + |
| 76 | +# 清理备份引用 |
| 77 | +rm -rf .git/refs/original/ |
| 78 | + |
| 79 | +# 清理 reflog |
| 80 | +git reflog expire --expire=now --all |
| 81 | + |
| 82 | +# 垃圾回收 |
| 83 | +git gc --prune=now --aggressive |
| 84 | + |
| 85 | +# 验证清理结果 |
| 86 | +git log --all -p | grep -c "<sensitive-data>" |
| 87 | +``` |
| 88 | + |
| 89 | +#### GitHub Secrets 使用示例 |
| 90 | +```bash |
| 91 | +# 编码文件为 Base64 |
| 92 | +cat <file> | base64 -w 0 |
| 93 | + |
| 94 | +# 在 GitHub 设置中添加 Secret |
| 95 | +# Settings → Secrets and variables → Actions → New repository secret |
| 96 | +``` |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +### 参考资料 |
| 101 | +- [Git Filter Branch 文档](https://git-scm.com/docs/git-filter-branch) |
| 102 | +- [GitHub Secrets 文档](https://docs.github.com/en/actions/security-guides/encrypted-secrets) |
| 103 | +- [GitHub Actions 文档](https://docs.github.com/en/actions) |
0 commit comments