Skip to content

Grok ssh/WSL turns skip the PreToolUse overlay; deny-tier tools run #821

Closed

Description

@currentbits

Follow-up from #812. The isolated GROK_HOME overlay injects classifyTool as a Grok [[hooks.PreToolUse]] handler. runner.js skips that overlay when crossesBoundary(project) (ssh / WSL) and falls back to ensureGrokMcpConfig into ~/.grok — MCP only, no hook. wrapCommand also does not forward GROK_HOME, so a local overlay is invisible to the remote CLI.

Result: a deny-tier tool (curl | sh via run_terminal_command) can execute on the remote before the after-the-fact Guardrail stream notice.

Grok has no --hooks flag. Real pre-exec seam that survives the bind: deploy the same hook files onto the other side and prefix the wrap with env GROK_HOME=.... Official docs: PreToolUse still denies under --always-approve; $GROK_HOME/config.toml hooks are always trusted. The hook command must use remote node, not the local Electron process.execPath.

Do not weaken the local overlay or the Claude control_request path.

Tests must fail if a deny-tier tool on a crossesBoundary grok turn produces no block.

Related: #812, #697, #706, #409.

Activity

  1. added
    bug
    plan:doing
    on Sep 2, 2026
  2. currentbits commented on Sep 2, 2026

    @currentbits
    OwnerAuthor

    Implemented on coder/fork-fork-solenta-guardrail-deny-ask-int-5be3d7 (this thread, uncommitted).

    Grok has no --hooks flag. The ssh/WSL seam is the same PreToolUse overlay as #812, deployed onto the far side:

    • deployGrokGuardrailOverlay writes $HOME/.solenta/grok-homes/<threadId> via wrapCommand (hook.js + guardrails.js + config.toml; auth/session symlinks from remote ~/.grok)
    • wrapCommand / resolveSpawn prefix env GROK_HOME=... so the remote CLI sees it (process env is not forwarded)
    • Hook command is posix node, not local Electron process.execPath
    • CODER_GUARDRAILS=off skips deploy
    • Claude control_request unchanged

    Tests: electron/test/grok-guardrail-remote.test.js fails if a deny-tier tool on a crossesBoundary grok turn produces no block. Related suites green (141 in the grok/guardrail/ssh/wsl set).

    Limits: remote node required (hooks fail open); remote dests are not reclaimed; live grok 1.0.5 over ssh is not in CI.

  3. added
    plan:done
    and removed
    plan:doing
    on Sep 2, 2026
  4. currentbits commented on Sep 2, 2026

    @currentbits
    OwnerAuthor

    Worktree already on origin/main via #840 (ca6c5146). Closing and marking plan:done.

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

    bugplan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions