SuperAPI AI 工具集

secrets-with-git-crypt

安全与审计

查看项目

更新于 10-15 21:08

技能介绍

用途:为仓库中的敏感文件(.env、*.tfvars、sec.json、settings.json、keyfiles 等)提供基于 git-crypt 的加密与解密工作流,确保凭据不以明文提交,而是维护并提交对应的 .enc 加密副本。

主要能力:在用户提及 git-crypt、加密解密或密钥管理,或试图提交应加密文件、克隆含 .enc 文件的仓库、初始化新仓库、变更密钥时触发。提供辅助脚本 skills/secrets-with-git-crypt/scripts/git-crypt-helper.sh,支持 install、init <key_path>、unlock <key_path>、sync-to-enc [file]、sync-from-enc [file]、status 等命令,并自动维护 .gitignore 与 .gitattributes。

使用方式:先确认处于 Git 仓库(git rev-parse --is-inside-work-tree),并让辅助脚本可执行(chmod +x)。用 ./skills/secrets-with-git-crypt/scripts/git-crypt-helper.sh status 检查 git-crypt 是否可用,缺失时可执行 install(Debian/Ubuntu 下经 sudo apt-get install git-crypt)。新仓库用 init ~/secure-keys/my-project.key 初始化并导出密钥(密钥绝不可提交);克隆仓库用 unlock /path/to/existing.key 解锁。提交前用 sync-to-enc 生成 .enc 副本,解锁后用 sync-from-enc 还原明文。.gitattributes 需含 *.enc filter=git-crypt diff=git-crypt。

验证与限制:结束前运行 status 确认各文件为 [OK];用 git ls-files --error-unmatch .env 检查明文未被跟踪,若被跟踪立即 git rm --cached <file>;用 git-crypt status 确认 .enc 已加密。要求类 Unix 环境(Linux、WSL、macOS)及已初始化的 Git 仓库。其他平台支持、密钥托管方式与具体安全强度资料暂未提供。