release: 0.3.3, the Codex plugin hook inspects prompts again - #27
Merged
Merged
Conversation
The Codex command in hooks/hooks.json stood down when CLAUDE_PLUGIN_ROOT was set, to keep Claude Code from running it. Codex 0.151.0 sets that variable for its own plugin hooks, so from 0.3.1 the Codex plugin hook exited before inspecting anything and Codex reported it Completed. The guard now keys on PLUGIN_ROOT, which Claude Code leaves unset and Codex sets; the failure mode becomes double inspection instead of none. The tests that run the Codex command now set both variables as Codex does and fail on the 0.3.2 command. Seen live on Codex 0.151.0: Blocked under enforce. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0.2.0 wrote its default entity list by name, and the list predates CUSTOM. On an upgraded machine `shim config --custom` saved the pattern, said PASS, and it never matched. Adding a pattern now enables CUSTOM unless the same command disables it. Found in the 1.0 smoke pass (J3 then J4 on one home). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
Author
|
Added a second silent defect found in the same smoke pass: on a config migrated from 0.2.0 (explicit 11-entity list, no |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A silent no-inspection bug in 0.3.1 and 0.3.2, found during the 1.0 smoke pass.
What was wrong
plugins/shim-cli/hooks/hooks.json(the Codex hook file, which Claude Code also loads by convention) opened with[ -n "$CLAUDE_PLUGIN_ROOT" ] && exit 0so Claude Code would not run it. Codex 0.151.0 setsCLAUDE_PLUGIN_ROOTtoo — its hook engine exportsPLUGIN_ROOT,CLAUDE_PLUGIN_ROOT,PLUGIN_DATA,CLAUDE_PLUGIN_DATA(visible in the binary's strings next to the hooks engine). The command exited 0 before running the launcher, and Codex reportedCompleted. Underenforcenothing was blocked; under any mode nothing was reported.shim install codex(package route) was never affected.How it was found and pinned
Isolated
CODEX_HOME,user-prompt = "enforce", prompt with a synthetic email,codex exec --dangerously-bypass-hook-trust:shim install codex(package)hook: UserPromptSubmit BlockedCompletedGetSHIM/shim-cli)Completedhook: UserPromptSubmit Blocked(andCompletedunderobserve)The launcher, instrumented, never executed under Codex; the archive and launcher run by hand blocked correctly.
Fix
Guard on
[ -z "${PLUGIN_ROOT}" ] && exit 0: Claude Code leaves it unset (why the unguarded command used to run/hooks/run-shim), Codex sets it (and substitutes it textually). Fails safe: if Claude Code ever setPLUGIN_ROOT, a prompt is inspected twice, not zero times.Claude Code 2.1.263 with this branch's plugin (project scope, stock
/usr/bin/python33.9.6):UserPromptSubmit says: shim: found SECRET (1) in your prompt. Not modified.once, no exit-127 noise.Tests
tests/plugins/test_plugin.py:test_the_codex_command_keys_on_the_variable_only_codex_sets,test_the_codex_command_exits_silently_when_claude_code_runs_it(onlyCLAUDE_PLUGIN_ROOTset),test_the_codex_command_inspects_the_prompt_under_codex[text|environment](both variables set, as Codex does). The three Codex tests fail on 0.3.2'shooks.json. The old test's docstring encoded the wrong assumption ("sets no CLAUDE_PLUGIN_ROOT").Why a 0.3.3
Codex caches an installed plugin by version (
plugins/cache/shim-cli/shim-cli/0.3.2/), so a fix onmainunder the same version may not reach existing installs. Version 0.3.3 in the four declaring files, archive rebuilt,docs/releases/0.3.3.md,docs/compatibility.mdparagraph corrected.check.py: 2,006 passed.🤖 Generated with Claude Code