Skip to content

No PreToolUse guard under Codex: aws-write-guard and permissions.deny do not port #826

Closed

Description

@athvin

Found while bridging the agent config to Codex (#823).

.claude/settings.json wires scripts/hooks/aws-write-guard.sh as a
PreToolUse hook on Bash(aws *), Bash(terraform *), Bash(kubectl *) and
Bash(helm *). Under Codex nothing equivalent runs. Probed against Codex
0.167.0: a project-level .codex/hooks.json and a project-level
.agents/hooks.json were both placed with a SessionStart hook that touches a
marker file, and neither fired — only $CODEX_HOME/hooks.json did. Those two
path strings do exist in the Codex binary, inside its Claude-Code migration
reader, which imports into $CODEX_HOME — which is exactly what makes them
look repo-scoped when grepped.

permissions.deny is the same story: Codex has no per-command deny list, so
pkill, killall and the destructive aws entries are unenforced there. Its
substitute is sandbox_mode / approval_policy, and the invocation in use here
is codex --dangerously-bypass-approvals-and-sandbox --profile kimi, which
removes that too.

So on the Codex path the only things standing between an agent and this account
are the read-only er-readonly profile in .mcp.json and the IAM denies on the
permission sets. That may well be the right answer — the guard was always
belt-and-braces over IAM — but it is currently true by accident rather than by
decision, and make check cannot see it either way.

The options, in increasing cost

  1. Decide it is fine and write that down. The guard's own value is that it
    catches a mistake before it reaches AWS; IAM catches it at AWS. Record the
    decision in the aws-account-operations skill so the next session does not
    re-derive the gap.
  2. Port the guard per-developer. A scripts/codex-hooks-sync.sh alongside
    scripts/codex-mcp-sync.sh, writing a PreToolUse entry into
    $CODEX_HOME/hooks.json that calls the same script. Codex's hook event
    names match Claude Code's (PreToolUse, PostToolUse, SessionStart, …),
    so the shape transfers; what needs checking is the payload the hook receives
    and whether a non-zero exit actually blocks the call. Note hooks there carry
    a trusted_hash per entry in config.toml, so a changed hook needs
    re-trusting — and in a non-interactive codex exec that may mean it silently
    does not run, which would be a guard that exists and does nothing.
  3. Close it at IAM instead, which is where it cannot be bypassed by a flag.

(2) is only worth doing if its own trust/exit-code behaviour is proved first,
for the reason this repo keeps relearning: a guard whose precondition never
holds is decoration.

Acceptance

Either the decision from (1) is recorded in a skill, or a hook sync exists whose
blocking behaviour has been observed — a denied aws write under Codex,
actually refused, in a non-interactive run.

Activity

  1. added
    ci-backlog
    on Nov 7, 2026
  2. self-assigned this
    on Nov 8, 2026
  3. added a commit that references this issue on Nov 8, 2026
    263e05a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ci-backlog

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions