From 16435addb3ab66140bbd3f3fa7bf39e01771174f Mon Sep 17 00:00:00 2001 From: yashrajbasav Date: Mon, 5 Oct 2026 10:46:11 +0530 Subject: [PATCH 1/2] fix(security): fail closed for unsafe Codex CLI analysis Signed-off-by: yashrajbasav --- src/skillspector/providers/_agent_cli.py | 78 +++--------- .../providers/codex_cli/provider.py | 24 +--- tests/unit/test_agent_cli.py | 117 ++++-------------- 3 files changed, 47 insertions(+), 172 deletions(-) diff --git a/src/skillspector/providers/_agent_cli.py b/src/skillspector/providers/_agent_cli.py index e69d71c2b..206be2b9f 100644 --- a/src/skillspector/providers/_agent_cli.py +++ b/src/skillspector/providers/_agent_cli.py @@ -26,8 +26,8 @@ adversarial skill content) is written to the process stdin, never injected into argv. - **Capability stripping** (per-binary): tools disabled, MCP disabled, - no extra directories, deny permission mode (claude); read-only sandbox - (codex). ``--dangerously-skip-permissions`` is NEVER used. + no extra directories, deny permission mode (claude). Codex is disabled + until a complete no-tools policy is verified. ``--dangerously-skip-permissions`` is NEVER used. - **Environment scrubbing**: API keys, SSH keys, cloud credentials, and other secrets are stripped from the child environment. - **Timeout enforcement**: the call raises ``TimeoutError`` rather than @@ -276,60 +276,21 @@ def _parse_claude_output(raw: str) -> str: # --------------------------------------------------------------------------- -def _build_codex_argv(binary: str, model: str, max_output_tokens: int = 0) -> list[str]: - """Build the argv list for a capability-stripped ``codex exec`` call. - - Flags chosen (verified end-to-end against codex 0.139.0): - - ``exec`` - Non-interactive subcommand. With NO positional prompt, codex reads the - instructions from stdin — which is exactly where the runner pipes the - prompt. (Passing ``-`` makes the prompt literally ``"-"`` and demotes - the real content to a ```` block, so we do not pass it.) - - ``--json`` - Emit JSONL events to stdout, enabling structured parsing. - - ``--sandbox read-only`` - Most restrictive sandbox mode. Model-generated shell commands are - restricted to read-only filesystem access; no code execution. Unlike - claude/gemini (which block model tool use entirely), codex's strictest - mode still permits read-only filesystem *reads* by model-generated - commands. This is informational, not an exfil channel: the call runs in - an isolated empty temp CWD, output returns only to the operator's own - report, and there is no network egress path. - - ``--ephemeral`` - Do not persist session files to disk (no residue from the scan). - - ``--ignore-user-config`` - Ignore ``$CODEX_HOME/config.toml``; use only our explicit flags. +_CODEX_DISABLED_REASON = ( + "codex_cli is disabled: its read-only sandbox still permits commands to read " + "host files, and SkillSpector has no verified deny-all-tools policy for Codex. " + "Use an HTTP API provider or another supported CLI provider instead." +) - ``--ignore-rules`` - Do not load user/project ``.rules`` files. - ``--model