fix(hooks): crash-proof PostToolUse read-only enforcement - #92
Merged
Conversation
- scrub whole LD_*/DYLD_* env class in plugin hook (finite list missed unlisted vars, re-triggering the NotCapable crash class) - wire test asserts the catch mechanism, not a comment token (CHK1) - direnv branch keeps 'nothing checked' guidance when it exits without a verdict - README: drop strip write-failure entry (hook is read-only), fix the --strip example to a real payload form - settings flake hint matches the launcher guidance (bwrap)
This was referenced Aug 30, 2026
Closed
Closed
Closed
Collaborator
Author
Residual Review FindingsFrom ce-code-review run Filed tickets
All tickets linked to this PR. Residual risks (not filed)
Coverage
|
A hook reports state; it never instructs the agent. The settings command
and the launcher no longer emit install/action guidance ('pnpm add',
'direnv allow') that the model could act on from hook text. Absent
checker -> bare status line on stderr + exit 1; flagged -> exit 2.
wire.rs pins the no-instruction invariant on both surfaces.
Source-text grep assertions restated the config that contained the strings; reverting the behavior still passed. Delete the file and the narrating comments in the launcher. Verification is behavioral (smokes).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The PostToolUse hook could not enforce. The Deno launcher crashed with an uncaught
NotCapableerror whenever a Deno-sensitive env var (LD_*,DYLD_*) was present, and the settings-surface hook ended in a silent|| exit 0— every write passed without being checked.Now the hook runs plain check mode on both shipped surfaces:
PostToolUse(notPreToolUse), read-only (no--strip, no file writes), no silent success. A flagged write exits 2 with the report on stderr; an absent checker exits 1 with a bare status line. The hook reports state — it never instructs the agent to install or run anything.The hook command scrubs the whole
LD_*/DYLD_*env class before starting Deno, and the launcher treats any spawn failure as binary-unavailable instead of throwing, so no environment can turn the hook into a crash or a silent pass.Session-settled decisions carried from planning:
PostToolUsehook (user-directed, overPreToolUse); read-only check mode (user-directed, over--stripin the hook path).Verification
PostToolUse, check mode, no|| exit 0, class-level env scrub, and the catch-without-rethrow mechanism.LD_PRELOAD_64+LD_ASSUME_KERNEL+LD_FOR_BUILDset: checker runs, flagged write exits 2 with report.