Skip to content

Grant Codex hook trust per machine — an untrusted PreToolUse guard is skipped silently #835

Not planned

Description

@athvin

Follow-up from #826 / PR #830, which shipped the Codex PreToolUse guard.

The guard is installed per machine by scripts/codex-hooks-sync.sh, and
Codex silently skips a hook it has not trusted — no warning, no log line,
the command just runs. So an installed guard protects nothing until trust is
granted, which is the worst state available: it reads as cover.

Two ways to be trusted, and only one is durable:

  1. Interactive approval, once per machine. Start codex in the repo and
    approve the hook when prompted. That writes a
    [hooks.state."<file>:<event>:<i>:<j>"] trusted_hash entry into
    $CODEX_HOME/config.toml, after which every later run honours it —
    codex exec included.
  2. --dangerously-bypass-hook-trust on every invocation. This works but
    persists nothing — verified across four bypassed runs, which left
    config.toml untouched — so it has to be remembered every time, and the day
    it is forgotten the guard is absent without saying so.

This cannot be scripted. Deriving the trusted_hash so the installer could
self-trust was attempted against the one known-good entry and failed across
twelve candidate recipes (command string, with/without newline, the state key,
key+command, several JSON encodings of the hook entry, the whole file). And an
agent cannot drive an interactive approval from a tool call.

What is owed

  • Approve the hook interactively on each machine that runs Codex or Kimi
    against this repo, so sessions stop depending on the bypass flag.
  • Confirm it took, the only way that proves anything: ask a session to run
    a denied command without --dangerously-bypass-hook-trust and look
    for Command blocked by PreToolUse hook: ….

Until both are done, treat the Codex path as guarded only when that flag is
passed. What does already hold: a deny blocks even under
--dangerously-bypass-approvals-and-sandbox — sandbox bypass is not hook
bypass — so the protection is real once trusted.

Known state at filing: on the machine that landed #830 the guard is installed
and proven blocking with the bypass flag; trust is not granted.

Activity

  1. added
    followup
    on Nov 8, 2026
  2. added
    pruned
    on Nov 27, 2026
  3. athvin commented on Nov 27, 2026

    @athvin
    OwnerAuthor

    Closed in the 2026-11-26 board prune. The board now targets a deduplication tool that works the same whatever the data's source. This card is speculative or process upkeep, so it isn't needed for that. It's labelled pruned and can be reopened if it becomes relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    followuppruned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions