Skip to content

v1.0.4 — security patch (Codex P0 review of v1.0.3)

Choose a tag to compare

@taibaran taibaran released this 16 May 12:11

Security + correctness patch driven by a deep-research review of v1.0.3. All three reviewer agents (codex + gemini + grok) participated in the v1.0.3 audit; Codex caught two real P0 regressions plus one P1 inconsistency. Same-day patch.

Fixed

P0-A — `--effort` gate bypass in `cmdReview` + `cmdImagine`

v1.0.3's per-model gate (`modelSupportsReasoningEffort`) was only enforced inside `grokBaseArgs`. Two call sites appended `--effort` outside that helper — re-introducing the 4× 400 cascade on `grok-build` for:

  • `/grok:review --effort high`
  • `/grok:adversarial-review --effort high`
  • `/grok:imagine --effort high`
  • `/grok:imagine-video --effort high`

Fix: new `effortFlagForModel({effort, model, cwd, kind})` helper in `lib/grok.mjs` is the single source of truth. `grokBaseArgs` delegates to it. `cmdReview` now passes `effort` through (was missing). `cmdImagine` calls the helper directly.

P0-B — `--save-to` source-path exfiltration vector

`isSafeMediaPath` only validated characters (it approved any `/A-Za-z0-9._/-%@+` path including `/etc/passwd`). A prompt-injected grok could return `pwned` and the plugin would copy `/etc/passwd` to the user's `--save-to` destination — local-file exfiltration. Only triggerable with `--save-to` (v1.0.2+).

Fix: new `isUnderGrokSessionsDir(p)` helper uses `path.resolve` (collapses `..` segments) to require the resolved path equals or descends from `${GROK_HOME}/sessions/`. `copyMediaToSaveTo` guards before any `copyFileSync`.

P1 (bundled) — `GROK_HOME` consistency

`cleanGrokEnv` allows `GROK_HOME` through but `readGrokModelsCache` hardcoded `~/.grok/`. Enterprise users with re-homed grok hit null cache → conservative-forward → 400 cascade.

Fix: exported `grokHomeDir()` resolves `GROK_HOME || ~/.grok`. Used by both `readGrokModelsCache` and `isUnderGrokSessionsDir`.

Tests

13 new behavioral tests in `tests/v1-0-4-issue-fixes.test.mjs` covering all three fixes. 380 tests total (375 passing + 5 integration skipped).

Update

`/plugin` → `Manage installed plugins` → `grok@grok-plugin-cc` → `Update` → `/reload-plugins`.