Auto-loaded .c2pconfig path key overrides the caller-specified root, redirecting file reads
还没有人认领这个 Issue。
评估
调研方向
从 config_loader::load_config 开始,在这里 .c2pconfig 会从工作目录自动加载,然后沿该值进入 config::build_session,查看配置 path 在哪里优先于 CLI 路径参数。先复现:创建一个包含 .c2pconfig 的目录,将 path 设为另一个目录,用显式路径运行命令,并确认扫描了错误的目录。在翻转优先级使 CLI 优先后,检查配置和 CLI 解析测试,并添加一个覆盖显式路径加自动加载配置的用例。完成意味着使用显式路径参数,并且复现时不再输出另一个目录的内容。
由索引模型根据 Issue 内容生成。
描述
Summary
Configuration injection in code2prompt: config_loader::load_config auto-loads .c2pconfig from the current working directory. In config::build_session the config path takes precedence over the CLI path argument, so untrusted repo content can silently redirect the scan to an arbitrary local directory.
To reproduce
Create a repo containing .c2pconfig with 'path = ""' and default_output = "stdout", then run 'code2prompt -q -O - ' from that repo. The explicit path is ignored.
Expected
CLI path argument should override the config path per documented precedence.
Actual
The config-redirected directory was scanned and its marker emitted
Independent CLI reproduction confirmed that an auto-loaded .c2pconfig 'path' key overrides an explicit CLI path argument: running 'code2prompt -q -O - /tmp/other' from a directory whose .c2pconfig sets path= emitted the secret-dir marker and not the requested directory, contradicting the documented 'CLI Arguments > Configuration File' precedence.
Observed side effect:
Project Path: v3-secret-1795224564
Source Tree:
```txt
v3-secret-1795224564
└── marker.txt
marker.txt:
CONFIG_LEAKED_SECRET_98765_VERIFY_2026_MARKER
## Impact
Arbitrary local directory read redirection to the caller/LLM context via malicious repo content.
## Version
v4.2.0
- 主要语言
- Rust
- 星标
- 7.8k
- 派生
- 459
- 平均合并
- 3 天 20 小时
- 30 天内合并 PR
- 1
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mufeedvh/code2prompt 的其他 Issue
-
Symlink-to-file inside scanned root reads file content outside the root without --follow-symlinks未关闭
难度 2/5 1-3 小时 新手友好度 72/100
mufeedvh/code2prompt#354 ·
-
No tag 4.3.0未关闭
难度 1/5 1 小时以内 新手友好度 72/100
mufeedvh/code2prompt#340 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 62/100
mufeedvh/code2prompt#356 ·
-
难度 3/5 1-2 天 新手友好度 66/100
mufeedvh/code2prompt#352 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 52/100
mufeedvh/code2prompt#345 ·
查看 mufeedvh/code2prompt 的全部 Issue
相似的 Issue
-
marketing
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
area:3d effort:medium P7 source:agent
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
enhancement ready-for-agent
难度 2/5 1-3 小时 新手友好度 65/100
publicusr/singularity#55 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 80/100
akitaonrails/ai-memory#2446 ·
维护者通常 1 天内回复