Skip to content

Commit 5f3b817

Browse files
committed
fix: moves COPILOT_HOOKS_DENY_DEMO guard to ensure deny() in scope
1 parent 8d8afd5 commit 5f3b817

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

content/copilot/tutorials/copilot-cli-hooks.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -394,15 +394,6 @@ fi
394394

395395
COMMAND="$(echo "$TOOL_ARGS_RAW" | jq -r '.command // empty')"
396396

397-
# ---------------------------------------------------------------------------
398-
# Demo-only deny rule for safe testing.
399-
# This blocks a harmless test command so you can validate the deny flow.
400-
# Remove this rule after confirming your hooks work as expected.
401-
# ---------------------------------------------------------------------------
402-
if echo "$COMMAND" | grep -q "COPILOT_HOOKS_DENY_DEMO"; then
403-
deny "Blocked demo command (test rule). Remove this rule after validating hooks."
404-
fi
405-
406397
deny() {
407398
local reason="$1"
408399

@@ -431,6 +422,15 @@ deny() {
431422
exit 0
432423
}
433424

425+
# ---------------------------------------------------------------------------
426+
# Demo-only deny rule for safe testing.
427+
# This blocks a harmless test command so you can validate the deny flow.
428+
# Remove this rule after confirming your hooks work as expected.
429+
# ---------------------------------------------------------------------------
430+
if echo "$COMMAND" | grep -q "COPILOT_HOOKS_DENY_DEMO"; then
431+
deny "Blocked demo command (test rule). Remove this rule after validating hooks."
432+
fi
433+
434434
# Privilege escalation
435435
if echo "$COMMAND" | grep -qE '\b(sudo|su|runas)\b'; then
436436
deny "Privilege escalation requires manual approval."

0 commit comments

Comments
 (0)