False positive: harmless `git -C <dir>` commands that mention `.env` are blocked

未关闭 适合新手
#24 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
git, python
领域
security, testing

调研方向

从 scripts/paths.py 中的 safe_file_operation 开始,将其命令解析与 #19 中引用的 Git 检查进行比较。更新对 -C <dir> 的处理,使列出的四个不打印输出的命令被允许,同时继续阻止 git -C app show HEAD:.env。在 tests/test_redteam.py 中为全部五种情况添加测试覆盖,并运行该测试文件以验证行为。

由索引模型根据 Issue 内容生成。

描述

bug

Plain-git versions of these are allowed because they never print the file's contents. With -C <dir> they are blocked:

  • git -C app rm --cached .env
  • git -C app commit -m "chore: stop tracking .env"
  • git -C app check-ignore -v .env
  • git -C app log --oneline -- .env

(git -C app show HEAD:.env prints the file, so it should stay blocked.)

Cause: safe_file_operation in scripts/paths.py only recognises these when the subcommand comes straight after git.

Done when

  • safe_file_operation uses the same -C handling as the Git checks (see #19), so the four commands above are allowed and git -C app show HEAD:.env is still blocked.
  • tests/test_redteam.py covers all five.

Generated by Claude Code

主要语言
Python
星标
1
派生
1
平均合并
2 小时 28 分钟
30 天内合并 PR
6

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

JTHCode/secretguard 的其他 Issue

查看 JTHCode/secretguard 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。