Skip to content

GitHub Copilot CLI integration

Keep secrets and customer data out of GitHub Copilot CLI

Maskflare hooks mask secrets and PII in the prompt GitHub Copilot CLI sends to the model and in every tool's arguments and results.
What Maskflare covers
  • Prompts: the prompt as the model will get it is masked. On a block rule's match the model gets a notice in its place. Copilot cannot stop a prompt, so the developer's own timeline keeps what they typed
  • Tool input: masked, or the call denied by a block rule, for every tool. Arguments that are not a JSON object are denied rather than rewritten. A masked call still goes through Copilot's own permission prompt
  • Tool output: masked for every tool, with a block rule's match withheld
  • File reads: masked in the view tool's result

Copilot CLI reads files and runs commands in your terminal. Anything it reads becomes part of the next request to the model.

Copilot reads every file in ~/.copilot/hooks, so the desktop agent writes its own, maskflare.json, with entries for the transformed prompt, before each tool and after each tool. It restores the file if it is changed and removes it when the hooks are turned off. VS Code's agent mode reads the same directory.

Set up GitHub Copilot CLI with Maskflare

The Maskflare desktop agent writes its own hook file into Copilot's hooks directory and keeps it in place. The prompt the model receives and every tool's arguments and results are masked.

Install the Copilot hooks
# With the desktop agent: set in the agent policy
"coding_agent_hooks": { "mode": "enforce", "tools": ["copilot"] }

# The agent writes ~/.copilot/hooks/maskflare.json, one entry per event
"<agent>" hook --agent copilot --event preToolUse --fail closed --maskflare-managed
# On Windows the entry runs from the powershell field (PowerShell 7)

# Without the desktop agent: copy examples/copilot/hooks.json from the
# Python SDK into ~/.copilot/hooks/

What gets masked

  • Prompts: the prompt as the model will get it is masked. On a block rule's match the model gets a notice in its place. Copilot cannot stop a prompt, so the developer's own timeline keeps what they typed
  • Tool input: masked, or the call denied by a block rule, for every tool. Arguments that are not a JSON object are denied rather than rewritten. A masked call still goes through Copilot's own permission prompt
  • Tool output: masked for every tool, with a block rule's match withheld
  • File reads: masked in the view tool's result
  • Your organization's rules, including 232 credential formats, in monitor mode (count only) or enforce mode

Good to know

  • Hooks are off by default. Start in monitor mode to count what they see, then switch to enforce.
  • A COPILOT_HOME the user has set moves Copilot's hooks away from the file the desktop agent writes.
  • A preToolUse hook that crashes denies the call; one that times out lets it through.
  • The hooks were tested against the payloads Copilot's hook reference documents and have not been checked live against Copilot CLI.
  • Prompt-injection detection does not run in the hooks; it runs on MCP traffic through the gateway.

Frequently asked questions

Can Maskflare stop a Copilot prompt?

No. Copilot does not let a hook stop a prompt. The model receives the masked prompt, or a notice if a block rule matched, while the developer's own timeline keeps what they typed.

Does Maskflare approve masked tool calls?

No. A masked call carries no permission decision, so Copilot's own permission prompt still applies.

Is this the same as the VS Code integration?

It is the same hook file. Copilot CLI and VS Code's agent mode both read it. See the VS Code agent mode page for that side.

Is every tool covered?

Yes. The entries have no tool filter, so every tool's arguments and results are checked.

Other coding agents integrations

All integrations

See it on your own data

Try Maskflare free.
Bring your hardest prompts.

28-day free trial or 10,000 requests, whichever comes first. Point one app at the gateway or enroll a few laptops,
and watch what gets masked. Or talk to us first.