Codex Security
$ codex-security 官方出品 中风险codex-security(@openai/codex-security)是 OpenAI 官方推出的安全分析命令行工具与 TypeScript SDK。原生面向编码 Agent 与 CI 流水线设计,支持 --llms 自描述清单输出、--format json|toon|jsonl|yaml、基于 Git --diff 的增量扫描以及 --working-tree 工作区检查。
npm install -g @openai/codex-security 自带专为 Agent 设计的 --llms 清单与 --format toon|json|jsonl 输出,直接在终端调用比封装为 MCP 更高效可靠。
核心事实概览
- 命令名
- $ codex-security
- FCRS-1.0 总分
- 92/100 (极佳 (Excellent))
- 证据置信度
- 中置信度 (源码/文档)
- CLI vs MCP 建议
- 优先选 CLI
- 评测日期
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
原生支持 --llms 自描述清单、--format json|toon|jsonl|yaml 以及非交互式 scan 子命令。
- Supports
--llms,--format json|toon|jsonl|yaml, and--working-tree
默认仅执行只读代码分析,可通过 --path、--diff 与 --exclude-path 精确限定范围并支持多种 --auth 认证方式。
- Scoped read-only scanning with env/ChatGPT auth
基于 Node.js 可通过 npm install -g @openai/codex-security 或 npx @openai/codex-security 一键运行。
- Distributed via npm (
@openai/codex-security)
在传统正则 SAST 基础上做真实漏洞验证,并原生支持紧凑的 toon 格式以节省 Agent 上下文。
- AI vulnerability validation plus native
toonandjsonlformatters
OpenAI 官方仓库(openai/codex-security,14.6k+ stars),采用 Apache-2.0 协议。
- Official
openai/codex-securityrepository
在 developers.openai.com/codex/security 提供官方文档,且命令行内置 --llms 自检说明。
- Docs at developers.openai.com/codex/security and
--llms
安全边界、鉴权与放权指南
支持 --auth auto|chatgpt|api-key,可复用 ChatGPT Codex 登录态或读取 OPENAI_API_KEY 等环境变量。
Apache-2.0 开源免费;执行安全分析需消耗 OpenAI/ChatGPT Codex 或所选推理提供商额度。
# codex-security Agent Rules - Run `codex-security --llms` once to verify supported `--format` and `--provider` flags. - Scope PR/branch checks with `--diff <base>` or `--working-tree` and `--format json` (or `toon`). - Review every suggested security patch before applying edits to production code.
Agent 高频安全命令配方
只读查询(安全推荐)
codex-security --llms
打印精简的机器可读清单,列出所有子命令、扫描参数与输出格式。
codex-security scan --working-tree --format json
分析未提交的代码改动并以 JSON 格式返回经过验证的漏洞结果。
受控写入与预演
codex-security scan --diff origin/main --exclude-path node_modules --format toon
扫描自 origin/main 以来的提交差异,并以节省 Token 的 TOON 格式输出。
核心优势
- + 原生提供
--llms标志及--format json|toon|jsonl|yaml多种结构化输出格式。 - + 支持
--diff <base>与--working-tree,适合快速低成本的 PR 与提交前安全审计。 - + 支持多家模型提供商(
openai、openrouter、fireworks、amazon-bedrock)及 ChatGPT 登录态。
注意事项与踩坑点
- ! 开启
--mode deep进行全仓深度扫描会消耗较多模型额度与耗时。 - ! 运行需具备有效 ChatGPT Codex 会话或支持的模型 API Key。