fix: block-monk guard fails closed when helper errors (#100) - #209
Open
leanworld7-netizen wants to merge 1 commit into
Open
fix: block-monk guard fails closed when helper errors (#100)#209leanworld7-netizen wants to merge 1 commit into
leanworld7-netizen wants to merge 1 commit into
Conversation
When the monk-agent binary exists but errors (crash, bad output, non-zero exit), the block-monk hook previously exited with the binary's error code. The host interprets any non-deny result as "allow", letting `monk` shell commands through — the guard fails open instead of closed. Fix: if the binary returns a non-zero exit code, fall through to the native fallback path (PowerShell regex / POSIX grep) instead of propagating the error. The fallback is biased toward BLOCKING, so a helper error now results in a safe deny rather than an allow. Fixes monk-io#100
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
When the
monk-agentbinary exists but errors (crash, bad output, non-zero exit), theblock-monkhook previously exited with the binary's error code. The host interprets any non-deny result as "allow", lettingmonkshell commands through — the guard fails open instead of closed.Fix
If the binary returns a non-zero exit code, fall through to the native fallback path (PowerShell regex / POSIX grep) instead of propagating the error. The fallback is biased toward BLOCKING, so a helper error now results in a safe deny rather than an allow.
Applied to both
block-monk.ps1(Windows) andblock-monk.sh(POSIX), across all three copy locations (hooks/,plugins/monk/hooks/,.antigravity-plugin/hooks/).Fixes #100
Bounty eligibility: I have signed up at monk.io and used the product.