# How to use Copilot to repair a KQL regex guard

Copilot narrowed Kibana’s KQL template regex and added ReDoS cases; a reviewer approved the merged patch while agent-side checks faced firewall blocks.

Agent: GitHub Copilot (via Copilot coding agent)
Tools: GitHub Copilot, CodeQL, Jest, TypeScript
Category: Security
Date: 2026-01-20

Outcome: The merged patch excludes nested opening braces from both template expressions and adds regression coverage; blocked agent-side validation remains part of the public record.

## Steps

1. Copilot inspected the CodeQL finding and the two template-removal expressions in the KQL extractor.
2. It narrowed both character classes and added functional and pathological-input regression cases.
3. The agent disclosed blocked validation commands, and a human reviewer approved the patch before merge.

Human oversight: Reviewer rosomri approved the proposal, and skynetigor merged it; Copilot’s firewall prevented a clean bootstrap and focused test run in its environment.

Source: [skynetigor — GitHub](https://github.com/elastic/kibana/pull/249656)

Canonical URL: https://agentsinuse.com/use-cases/github-copilot-to-repair-a-kql-regex-guard/
