Inspiration

Teams want AI agents to handle support, operations and sales work using real CRM records, tickets and email. But an MCP-connected agent typically gets every raw value its tools return, and it can send that data out with its next tool call. The trigger can be a mistake, or a prompt injection hidden in a support ticket. "The model usually refuses" isn't something a security team can sign off on, so we wanted the protection to live in the runtime.

What it does

Kerna is a local-first runtime trust layer between an AI agent and its tools. Our Privacy Gate adds:

  • Detection of emails, phone numbers, SSNs, card numbers and API keys in tool traffic
  • Pseudonymisation, so the agent sees [EMAIL_1] or [SSN_1] instead of the real value
  • Restoration inside the boundary, so internal tools still work
  • Egress control: exports carrying sensitive data are blocked, and a listed email tool is held for a single-use approval bound to the exact message
  • Hard limits: by default an approval can release only emails and phone numbers, never SSNs, cards or keys
  • Receipts and reports showing every decision

In our recorded demo, a support ticket hides an instruction to export customer data:

Without Kerna With Kerna
Sensitive values sent to the unauthorized destination 10 0
Raw sensitive values seen by the agent 14 0
Legitimate renewal email delivered Yes Yes, after approval

How we built it

The runtime is written in Rust and runs as an MCP gateway. The Privacy Gate uses deterministic pattern detectors and a session token vault, applied around the policy check and tool forwarding. We added a synthetic CRM with simulated email and export tools, a kerna privacy report command, and a Python benchmark that runs the same tasks three ways: direct MCP, Kerna with an open policy, and Kerna with the Privacy Gate.

Pre-existing work: the Kerna runtime, policy engine, gateway, approvals, receipts, dashboard and Trust Bench existed before the hackathon. The Privacy Gate, its benchmark and demo, and the related security fixes were built during it.

Challenges we ran into

  • Hiding data without breaking the task. Tokens had to stay consistent so the agent could still look up a customer and email them.
  • Careless approvers. A person can click "yes" to an attack, so we limited which kinds of data an approval can release.
  • Detection edge cases. Card numbers sitting right after an ID or SSN needed careful handling.
  • Protecting the audit trail. With an open policy, raw sensitive values ended up in Kerna's own logs.

Accomplishments that we're proud of

Across 22 scenarios with a scripted worst-case agent:

Direct MCP Kerna, open policy Kerna Privacy Gate
Attacks that leaked data 10/10 5/10 0/10
Sensitive values leaked 80 45 0
Legitimate tasks completed 10/10 10/10 10/10

Nine attacks were stopped automatically and one by a simulated human rejection. Median added latency was 5.9 ms per tool call in a debug build.

What we learned

  • Permissions alone aren't enough: what data a call carries matters too.
  • Approvals need limits, because reviewers make mistakes.
  • Logs need the same protection as the model's context.
  • Honest scope matters. Our results use synthetic data, simulated destinations and a scripted agent. They show what the boundary stops, not how often a real model gets attacked. Detection is pattern-based, so names, addresses and unknown secret formats can pass through. If a person approves the injected email, contact details can still be released.

What's next for Kerna

  • Pluggable detectors for names, addresses and health data
  • Evaluation with live models, not just scripted agents
  • An observe-first rollout path, so teams can see what would be redacted before enforcing it

Built With

Share this project:

Updates

Submission history