Skip to content

fix: block-monk guard fails closed when helper errors (#100) - #209

Open
leanworld7-netizen wants to merge 1 commit into
monk-io:mainfrom
leanworld7-netizen:fix/block-monk-fail-closed-100
Open

fix: block-monk guard fails closed when helper errors (#100)#209
leanworld7-netizen wants to merge 1 commit into
monk-io:mainfrom
leanworld7-netizen:fix/block-monk-fail-closed-100

Conversation

@leanworld7-netizen

Copy link
Copy Markdown

Summary

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.

Applied to both block-monk.ps1 (Windows) and block-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.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug bounty] Windows block-monk guard fails open when helper errors

1 participant