Skip to content

preToolUse agent hook denial does not work #3874

Description

@springcomp

Describe the bug

Running chat session from Copilot CLI, I have installed a hook that denies all commands.

Affected version

  • GitHub Copilot Chat Extension v1.0.65

Steps to reproduce the behavior

.github/hooks/hooks.json

{
  "version": 1,
  "hooks": {
    "preToolUse": [
      {
        "cwd": "src",
        "bash": "bin/Debug/net10.0/hook",
        "powershell": "bin/Debug/net10.0/hook",
        "timeoutSec": 15
      }
    ]
  }
}

A simple C# hook.exe program:

Program.cs

Console.WriteLine("{\"permissionDecision\":\"deny\"}");
Environment.Exit(2);

Here is a simple session prompt:

Give me the latest powershell Get-Date

I tried everything:

  • Exit code 2
  • {"permissionDecision": "deny"} response to preToolUse hook events.
  • {"behavior":"deny"} response to permissionRequest hook events.

Still, the tool is called and never denied.

Expected behavior

The tool call SHOULD be denied.

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:permissionsTool approval, security boundaries, sandbox mode, and directory restrictionsarea:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agents

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions