Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions plugins/security-guidance/hooks/security_reminder_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,16 @@ def main():
shown_warnings.add(warning_key)
save_state(session_id, shown_warnings)

# Output the warning to stderr and block execution
print(reminder, file=sys.stderr)
sys.exit(2) # Block tool execution (exit code 2 for PreToolUse hooks)
# Output structured JSON to stdout so the model receives the warning
output = {
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "deny"
},
"systemMessage": reminder
}
print(json.dumps(output))
sys.exit(0)

# Allow tool to proceed
sys.exit(0)
Expand Down