All posts

Segregation of Duties for Context Windows

When a language model consumes a context window that mixes data from multiple business units, the cost of a single slip can be catastrophic: confidential customer records may be exposed, compliance violations can trigger fines, and the organization loses trust in its AI initiatives. The root cause is often a lack of clear separation between who can inject data, who can read responses, and who can approve sensitive queries. Without a strong segregation of duties framework, a junior engineer could

Free White Paper

DPoP (Demonstration of Proof-of-Possession) + Context-Based Access Control: The Complete Guide

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

Free. No spam. Unsubscribe anytime.

When a language model consumes a context window that mixes data from multiple business units, the cost of a single slip can be catastrophic: confidential customer records may be exposed, compliance violations can trigger fines, and the organization loses trust in its AI initiatives. The root cause is often a lack of clear separation between who can inject data, who can read responses, and who can approve sensitive queries. Without a strong segregation of duties framework, a junior engineer could unintentionally surface protected information, or an automated process could bypass required oversight, leading to data leakage and regulatory risk.

Why context windows need segregation of duties

Context windows are the real‑time snapshot of information that an LLM uses to generate output. Applications populate them with prompts, retrieved documents, or runtime variables. Because the model does not understand organizational policy, teams must vet every piece of data that enters the window. If the same credential or service account fetches data and invokes the model, the system cannot enforce who is allowed to see what. This monolithic access pattern makes it impossible to audit who contributed each fragment of the prompt, and it defeats any attempt to enforce least‑privilege principles.

Current practice and its gaps

Many teams rely on shared API keys or static service accounts that have blanket read‑write rights to all data stores. Applications call the model directly, and the request flows straight to the backend without an intermediate checkpoint. In that configuration, the following gaps appear:

  • No record of which user or process supplied each piece of context.
  • In‑line data that should be redacted (PII, financial identifiers) can be echoed back to the caller.
  • The system processes urgent or high‑risk queries without any human review.
  • Any compromise of the shared credential instantly grants unrestricted access to every downstream system.

These gaps violate the core tenets of segregation of duties: separating the roles of data provision, request initiation, and approval.

What a proper control model looks like

A practical approach starts with a clear setup layer: each identity, whether a human engineer, an automated service, or an AI‑assistant, receives an OIDC or SAML token that encodes its role and group membership. The token decides whether the identity may request a context window, but the token does not enforce what happens to the data. The enforcement must happen in the data path, the point where the request leaves the caller and reaches the LLM.

Continue reading? Get the full guide.

DPoP (Demonstration of Proof-of-Possession) + Context-Based Access Control: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

In the data path, three enforcement outcomes are required:

  1. Audit: every prompt and response must be recorded with the identity that supplied it.
  2. Masking: any field that matches a protected pattern must be redacted before it reaches the model.
  3. Just‑in‑time approval: high‑risk queries must pause for a designated reviewer before the model processes them.

These outcomes cannot be achieved by the setup layer alone; they need a gateway that sits between the caller and the LLM.

How hoop.dev enforces segregation of duties for context windows

hoop.dev acts as the mandatory gateway in the data path. When a request arrives, hoop.dev extracts the caller’s identity from the OIDC token, checks the caller’s role, and then applies the three enforcement outcomes:

  • hoop.dev records each prompt, response, and the associated identity. This creates a tamper‑evident audit trail that auditors can query without needing access to the LLM itself.
  • hoop.dev masks any sensitive fields in the context window before they are forwarded. Masking rules live centrally, so developers never embed redaction logic in their code.
  • hoop.dev triggers a just‑in‑time approval workflow for queries that exceed a risk threshold. A reviewer receives a concise summary of the pending request and can approve or deny it, ensuring that privileged operations never execute automatically.

Because the gateway is the only place where traffic is inspected, the enforcement outcomes exist solely because hoop.dev sits in the data path. If hoop.dev were removed, the shared credentials would again have unchecked access, and the system would stop recording, masking, or approving requests.

Implementing this model begins with the standard getting‑started guide to deploy the gateway and register the LLM as a connection. The learn section explains how to define masking policies, configure risk thresholds, and integrate with existing identity providers. Once the gateway is in place, every context window request automatically inherits the segregation of duties controls without any code changes in the calling application.

Practical steps for teams

  1. Identify all roles that currently interact with the LLM and map them to distinct OIDC groups.
  2. Define which data elements in the context window are considered sensitive and create masking rules in hoop.dev.
  3. Set risk thresholds for queries that require manual approval, such as those that request financial data or trigger write‑back operations.
  4. Deploy hoop.dev as the sole entry point for LLM calls and retire any shared service accounts that bypass the gateway.
  5. Monitor the audit logs that hoop.dev produces; use them to verify that segregation of duties is being respected and to refine policies over time.

By following these steps, organizations turn a risky, monolithic access pattern into a controlled, auditable workflow that aligns with regulatory expectations and internal security policies.

Ready to see the code in action? Explore the open‑source repository on GitHub and start building a segregation‑of‑duties‑first architecture for your LLM context windows.

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