Every decision lands in Activity with
source.application = copilot-plugin, so you also get an audit trail; start in
Report policy mode to observe before enforcing.
Coverage limits: inline completions (ghost text) expose no hooks and are
out of scope. Copilot cloud coding-agent jobs load only hooks committed
under .github/hooks/*.json — see Cloud coding agent.
Console setup
- Create a GitHub Copilot collector (Catalog → AI assistants & coding agents).
- Mint a
tgk_…API key on the Auth tab (shown once — store it). - Assign a default policy on the Policies tab.
Local / pilot
Copilot CLI has a plugin marketplace flow:TRUSTGUARD_DATA_URL, TRUSTGUARD_API_KEY,
TRUSTGUARD_FAIL_MODE, TRUSTGUARD_TIMEOUT_MS, TRUSTGUARD_TRANSFORM_ACTION,
TRUSTGUARD_CONSUMER_ID) override the user file.
If a personal install is incomplete, the marketplace bootstrap emits {} and
exits 0 on purpose — Copilot’s preToolUse command hooks fail closed on
non-zero exits, and a half-installed plugin must not brick Copilot.
Enterprise
IT deploys policy hooks, which Copilot CLI loads machine-wide before user, repository, and plugin hooks — developers cannot disable them (disableAllHooks does not apply). Kandji scripts live under
mdm/kandji/;
they install four pieces:
The policy hook file calls the wrapper, not the collector directly, so one
file works across platforms (
TRUSTGUARD_COPILOT_BIN overrides the lookup).
The wrapper distinguishes two failures on purpose: collector not installed
→ allow (a machine mid-provisioning is not bricked); collector installed but
failing → preToolUse is denied and postToolUse output marked untrusted.
Normal data-plane errors follow the configured fail_mode.
VS Code Agent mode: install the plugin from the organization marketplace.
Agent hooks are currently a VS Code preview feature — ensure enterprise
policy permits hooks and controls marketplace sources.
Cloud coding agent
Cloud jobs receive no local plugins, user hooks, MDM files, or policy hooks. To cover them:- Commit a Copilot hook file under
.github/hooks/. - Make the collector binary available in the job image (or use an HTTP hook endpoint that accepts Copilot’s event payload).
- Add the TrustGuard host to the cloud-agent firewall allowlist.
- Provide credentials through the approved GitHub environment mechanism.
userPromptSubmitted
remains audit-only.
Verify
- Run Copilot CLI and send a test prompt, then trigger a shell tool call.
- Confirm the events in TrustGuard Activity
(
source.application = copilot-plugin).
What is evaluated
Attributes
attributes.source.application = "copilot-plugin"attributes.copilot.*— the full hook stdin JSON is preservedconsumer_idsent only when configured explicitly (TRUSTGUARD_CONSUMER_ID/consumer_idincopilot.json)