Skip to content

v2.4.6

Choose a tag to compare

@randomittin randomittin released this 11 Oct 16:30
· 1294 commits to main since this release

The hooks-trust release. Heimdall's hooks no longer run scripts from the repo a session happens to be in: with CLAUDE_PLUGIN_ROOT unset they did, so a cloned repo could run its own code on every tool call. Roots now come only from CLAUDE_PLUGIN_ROOT or ~/.heimdall, and the push gate catches git push however it is written. A linter that fails to run is reported as a tool error instead of as findings, and heimdall-stop-lint works with ESLint 9.

2.4.5 was a GitHub-only release and never reached npm; take 2.4.6 instead.

Security

  • Hooks never run scripts from the session's repo — hooks/hooks.json took the plugin root from CLAUDE_PLUGIN_ROOT or, with that unset, from the git toplevel of the current directory, so all 49 hook commands executed bin/<script> out of whatever repo the session was in (and bin/lib/hook-enabled.sh was sourced from it). A cloned repo that shipped a script under a hooked name therefore ran its code on every tool call. Every hook command now takes its root only from CLAUDE_PLUGIN_ROOT or the install at ~/.heimdall, never from the working directory: no path derived from the cwd can be trusted, and a marker inside a repo is forgeable by any repo. The hook-enabled lookup and the caveman and checkpoint copy-paste snippets follow the same rule. When no root resolves, the Bash and Agent prechecks, the credential filter, the credential-read guard and the lint-config guard fail open with one UNCHECKED line on stderr (the gates are Heimdall's own repo policy, there is nothing of Heimdall's to run in a foreign repo, the native pre-push hook and CI stay the backstop, and failing closed would block every call), while the Write/Edit stub gate stays fail-closed. Test: test/hooks-no-cwd-exec.test.sh runs every hook command in a clone with a planted script for each hooked name; none of them runs.
  • The push gate catches git push in any form — bin/heimdall-precheck-bash matched only a command line that started with git push, so its quality-gate check did not see git -C <dir> push, cd <dir> && git push, make; git push, FOO=1 git push or sh -c 'git push'. It now matches git as a command word after separators, env assignments, wrapper words, subshells and sh -c, with global options such as -C <dir>. Text that only mentions a push, git stash push and git pushd stay ungated. Tests: test/heimdall-precheck-bash.test.sh cases 17 and 25-29.

Fixed

  • A precheck deny says why — bin/heimdall-precheck-bash wrote its deny verdict to stdout and exited 2, and Claude Code shows only stderr for an exit-2 hook, so a legitimate quality-gate deny (tests not passing, lint not clean, no sweep receipt) appeared as "hook error ... No stderr output". The verdict is now stated on stderr too, as precheck-agent and the stub gate already did. The same change fixed a latent failure: with CLAUDE_PLUGIN_ROOT unset, the Bash and Agent hooks took the cwd repo as the plugin root and exited 127 on every call in any repo that is not Heimdall's; they now fail open with one stderr line (see Security).
  • stop-lint works with ESLint 9 and lints only the repo — ESLint 9 removed the unix formatter, so every eslint -f unix call exited 2 and was counted as a lint finding: lint_clean flipped false (46 phantom findings in one repo) and the push gate blocked although ESLint over the whole repo was clean. bin/heimdall-stop-lint now reads -f json through --output-file (core in ESLint 8 and 9, and Node's stderr noise cannot corrupt the report). An ESLint that fails to run (config error, crash, missing interpreter) is a tool error, not findings: reported loudly with its own diagnostics, counted in the receipt's tool_errors, the run marked incomplete and lint_clean left as it was, a non-verdict like a timeout, because red would fake findings and green would fake evidence. It also lints only files inside --repo: .claude/worktrees/, .heimdall/, node_modules/ and anything outside the repo (the Claude scratchpad, TMPDIR, other checkouts, .. escapes) are dropped and the receipt records what was excluded, so stale agent worktrees no longer burn its 60 s budget. Test: test/heimdall-stop-lint.test.sh.
  • Biome, ruff, shellcheck and tsc failures are tool errors too — a non-zero exit was read as findings for all of them, but the codes differ: shellcheck 2-4 and ruff 2 and 101 are failures, and biome exits 1 for findings and for a config error, so a broken config or flag showed up as phantom findings and turned lint_clean red. shellcheck -f json, ruff --output-format json and biome --reporter=json are now read from stdout (stderr kept apart); exit 1 with at least one problem in the report is a finding, counted from the report. Anything else (exit 2 or higher, a crash, a bad flag or format, an unreadable report, ruff's E902, biome's internalError, a missing binary or interpreter) is a tool error, handled as above. bash -n (exit 126 or 127), the Python ast check (exit 1 without a SyntaxError) and tsc (no file-located diagnostic) draw the same line. Tests: fake binaries per tool (clean, findings, config error, crash, bad flag, silent, missing interpreter) in both lint_clean states, plus the real shellcheck and ruff, in test/heimdall-stop-lint.test.sh.
  • The zero-footprint test no longer waits on a published release tag — its real-hmd and npx cases ran the wrapper against the checkout's hmd, whose --version resolves from the nearest git tag. In a release's own pre-push sweep the new tag does not exist yet, so that hmd looked older than the pin and the wrapper fetched install.sh from the unpublished tag (HTTP 404): the release gate could never go green. Those cases now pin the wrapper to the version the checkout's hmd reports (RUNHMD_TAG) and hand it a tripwire installer (RUNHMD_INSTALL_SCRIPT) that must never be touched; the tree's own install.sh is served from disk, where a tampered copy is refused under the genuine digest, the genuine one is verified, and a mutant without the digest check goes red. The shipped wrapper is unchanged. Test: test/zero-footprint.test.sh.

Changed

  • --wait-quiet is documented — CLAUDE.md now says when to use the opt-in quiet gate of the full sweep: on a shared, busy machine, to start it on a settled box. The wait is relative and bounded (the 15-minute load average below HMD_QUIET_FACTOR, default 1.5, times the CPU count on 3 consecutive 30 s checks; it gives up after HMD_QUIET_MAX_WAIT_S, default 1200 s, and the sweep then runs with half the jobs and HMD_TEST_REDUCED_PARALLELISM=1). It also says not to block a sweep on an absolute load threshold, which can stay high for hours and defer the run forever, and to lower --jobs on a busy machine instead of waiting.
  • The old eye-and-H logo assets are removed — the six hmd-logo-eye-h* files (about 1.8 MB) in launch-docs/assets/ and their provenance.json entries are deleted; the README header and the dream bundle already point at the pixel helm. A README published to npm before this release hotlinks hmd-logo-eye-h-mark*.png from main, so its header image stays broken until this release is published.

Full changelog: v2.4.5...v2.4.6

Install/upgrade:

curl -fsSL https://raw.githubusercontent.com/randomittin/heimdall/v2.4.6/install.sh | bash

install.sh.minisig is the detached minisign signature of this release's install.sh; bin/heimdall-autoupdate verifies it against release/heimdall-signing.pub before applying.