All posts

MCP gateways: what they mean for your prompt-injection risk (on Azure)

Teams that expose LLMs through MCP gateways on Azure often configure a single service‑account credential that every internal tool uses, creating a high prompt-injection risk because the gateway forwards requests directly to the model without per‑user visibility. The gateway shares that credential across all callers, and no component records which user issued which prompt. In this configuration, there is no per‑user audit, no real‑time masking of responses, and no way to require human approval fo

Free White Paper

Prompt Injection Prevention + Risk-Based Access Control: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

Teams that expose LLMs through MCP gateways on Azure often configure a single service‑account credential that every internal tool uses, creating a high prompt-injection risk because the gateway forwards requests directly to the model without per‑user visibility. The gateway shares that credential across all callers, and no component records which user issued which prompt. In this configuration, there is no per‑user audit, no real‑time masking of responses, and no way to require human approval for risky instructions.

The typical mitigation strategy is to add client‑side checks or static prompt templates, but those rely on every caller to implement the same logic correctly. When multiple services, third‑party plugins, or automated agents use the same endpoint, an attacker who compromises any upstream component can inject a hidden instruction that bypasses superficial validation. The result is the model executing a malicious command or leaking secrets, and the organization has no reliable evidence of who triggered it.

What you need is a single enforcement point that sits in the data path, inspects every request, applies masking, blocks disallowed prompts, and records the full session linked to the authenticated identity. Only a gateway that can enforce policy before the model sees the prompt can guarantee that prompt-injection risk is reduced to an acceptable level.

hoop.dev as the server‑side enforcement layer

hoop.dev fulfills that requirement by acting as an identity‑aware proxy positioned directly in front of the Azure‑hosted LLM. It terminates the client connection, authenticates the caller via OIDC/SAML, and then forwards the request to the model only after applying policy checks. Because hoop.dev sits in the data path, it enforces the following outcomes:

  • Session recording: hoop.dev records each prompt and response, linking them to the authenticated identity for a complete audit trail.
  • Inline masking: hoop.dev redacts or replaces sensitive tokens in the model’s output before they reach the caller.
  • Prompt blocking: hoop.dev evaluates incoming text against configurable patterns and rejects any request that appears to contain a malicious instruction.
  • Just‑in‑time approval: for high‑risk operations, hoop.dev routes the request to an approver, pausing execution until explicit consent is recorded.

hoop.dev enforces all of these controls at the gateway, so the LLM never sees a request that has not passed the policy engine, and the caller never receives a response that has not been inspected.

How the architecture fits with MCP gateways on Azure

When an application calls the Azure LLM endpoint, it points its HTTP client at the hoop.dev gateway instead of the raw Azure URL. A lightweight agent runs inside the same virtual network as the LLM, providing a secure path for the proxied traffic. The gateway holds the Azure credential needed to invoke the model, so the calling service never handles a secret. The gateway performs authentication once using the organization’s identity provider; it then uses the resulting identity for policy evaluation.

Continue reading? Get the full guide.

Prompt Injection Prevention + Risk-Based Access Control: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Because hoop.dev is open source, teams can extend the policy engine to match their own risk model, integrate with existing ticketing or approval systems, and store audit logs in a location that satisfies internal compliance requirements.

Benefits of moving prompt‑injection defense to the data path

Placing the guardrails in the data path eliminates the need for each client to implement its own sanitization logic, reducing the surface area for bugs. hoop.dev also provides a single source of truth for who issued which prompt, what the model returned, and whether any masking or approval took place. This unified view is invaluable during incident response and for meeting audit requirements under standards such as SOC 2.

Because hoop.dev records every session, you can replay interactions to verify that a suspicious output was indeed the result of a malicious prompt, rather than a model hallucination.

Getting started

To try this approach, follow the getting‑started guide and explore the feature documentation on the learn page. The repository contains Docker Compose files that spin up the gateway and the required agent in a single command.

FAQ

How does hoop.dev differentiate between benign and malicious prompts?

hoop.dev applies configurable pattern matching, token‑level analysis, and optional integration with external threat‑intelligence feeds. Policies evaluate the full prompt before it reaches the model, ensuring that any disallowed instruction is blocked.

Can hoop.dev be used with LLM providers other than Azure?

Yes. Because hoop.dev operates at the protocol layer, it can proxy any HTTP‑based LLM endpoint, provided you configure the appropriate credential in the connection definition.

Take the next step

Explore the open‑source implementation on GitHub to see how you can secure your MCP gateways against prompt‑injection risk.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts