OpenAI Codex 仍未解决排除敏感文件的问题
A way to exclude sensitive files issue still open for OpenAI Codex

原始链接: https://github.com/openai/codex/issues/2847

您希望看到什么功能? 一种在仓库和全局层面明确标记代理程序不得读取或发送至模型的机制(例如:仓库本地的 .codexignore 加上全局忽略文件)。 示例:保持 node_modules/ 可被搜索以进行实现检查,但绝不读取或发送 .env、.env.*、.pem、id_、.aws/、.ssh/ 等文件。该配置应当是确定性的,支持团队/仓库间共享,并支持用户默认设置,而不是依赖项目文档或约定。 您是否有兴趣实现此功能? 是的,我可以参与开发并进行测试。 其他信息: 相关议题:#205。该议题提出了两个主要用例:防止敏感数据被发送至模型,以及排除大型/无关文件。该议题曾因转向 Rust (codex-rs) 实现而被关闭,但截至 2025 年 8 月 28 日,codex-rs 中似乎尚不存在类似功能。我希望重启讨论并就设计方案达成一致。

近期的一场 Hacker News 讨论聚焦于关于 OpenAI Codex 排除敏感文件问题的争议。虽然一些用户主张引入原生的“.aiignore”功能以防止智能体访问敏感数据,但许多技术评论者达成的共识是,这一责任应由用户而非模型承担。 批评原生功能的人士认为,这会提供一种虚假的安全感,因为大语言模型通常可以通过 bash 命令或其他工具找到绕过限制的方法。他们建议将 AI 智能体视为不可信实体,并采用成熟的系统级安全实践,例如使用 `chmod` 权限、在隔离容器中运行智能体,或使用专门的沙盒工具来限制文件系统访问。 归根结底,该讨论反映了用户之间的分歧:一方期望拥有用户友好且基于功能特性的“忽略”机制,另一方则认为开发人员应依赖基础的软件安全抽象,而不应指望由 AI 框架来管理访问控制。
相关文章

原文

What feature would you like to see?

  • A mechanism to explicitly mark files/paths that the agent must not read or send to the model, at both repository and global levels (e.g., a repo-local .codexignore plus a global ignore file).
  • Example: keep node_modules/ searchable for implementation checks, but never read or send .env, .env.*, .pem, id_, .aws/, .ssh/.
  • The configuration should be deterministic and shareable across the team/repo, and also support user defaults, rather than relying on project documentation or conventions.

Are you interested in implementing this feature?

  • Yes — I can contribute and tests.

Additional information

Related: #205. That issue surfaced two primary use cases: preventing sensitive data from being sent to the model and excluding large/irrelevant files. The issue was closed in favor of a Rust (codex-rs) implementation, but as of 2025-08-28 a comparable feature does not appear to exist in codex-rs. I’d like to restart the discussion and converge on a design.

联系我们 contact @ memedata.com