All posts

What PHI Means for Subagents

How do you keep phi safe when a subagent runs on your network? Subagents are lightweight processes that act on behalf of a larger service – for example, a job runner that pulls data from a database, a background worker that writes logs, or an AI‑assisted assistant that queries internal APIs. They are convenient because they can be started automatically, scale horizontally, and often run with a single set of credentials. The convenience, however, creates a blind spot: the subagent may read, tran

Free White Paper

PHI Means: The Complete Guide

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

Free. No spam. Unsubscribe anytime.

How do you keep phi safe when a subagent runs on your network?

Subagents are lightweight processes that act on behalf of a larger service – for example, a job runner that pulls data from a database, a background worker that writes logs, or an AI‑assisted assistant that queries internal APIs. They are convenient because they can be started automatically, scale horizontally, and often run with a single set of credentials. The convenience, however, creates a blind spot: the subagent may read, transform, or forward phi without any human in the loop, and the organization frequently lacks visibility into exactly what was accessed.

Why subagents struggle with phi today

In many environments the default pattern is to embed a static database user or an IAM role directly into the subagent’s configuration. The subagent connects straight to the target system, and the connection is treated as a permanent “standing access” grant. Engineers rarely rotate those credentials, and audit logs are limited to the target’s own logging, which may not capture the exact query or the downstream data that left the system. When a subagent is compromised, an attacker inherits the same unrestricted read rights and can exfiltrate phi without triggering any alert.

The missing enforcement layer

What is needed is a runtime guard that sits between the subagent’s identity and the resource it talks to. The guard must enforce least‑privilege, require explicit approval for operations that touch phi, mask sensitive fields in responses, and record every session for later replay. The identity and token checks that happen at login – the setup – can tell us who the subagent is, but they cannot stop a malicious subagent from issuing a dangerous query once the connection is established. Without a dedicated data‑path, the request still reaches the database directly, leaving no place to apply inline masking or to capture a complete audit trail.

hoop.dev as the data‑path gateway for phi

Enter hoop.dev. It is a Layer 7 gateway that sits on the network edge and proxies every subagent connection to supported targets such as PostgreSQL, MySQL, or SSH. The setup – OIDC or SAML authentication, role‑based groups, and service‑account provisioning – decides which subagent may start a session. Once the session is initiated, the data path provided by hoop.dev becomes the only point where enforcement can happen.

hoop.dev masks phi in real time. When a query returns a column that contains a patient identifier or a health record number, the gateway can replace the value with a token or a redacted placeholder before it ever reaches the subagent’s process memory. This ensures that even a compromised subagent never sees the raw phi.

Continue reading? Get the full guide.

PHI Means: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

hoop.dev blocks unauthorized commands. If a subagent attempts a bulk export, a DELETE that touches a table flagged as containing phi, or any command that matches a policy requiring human sign‑off, the gateway intercepts the request and routes it to an approval workflow. The subagent receives a clear denial until an authorized reviewer grants temporary permission.

hoop.dev records every session. Each interaction – the exact query text, the masked response, timestamps, and the identity that initiated it – is stored as an audit record. Teams can replay a session to see exactly what data was accessed, satisfying auditors who need evidence of controlled phi handling.

All of these outcomes exist only because hoop.dev occupies the data‑path. If you removed hoop.dev and left only the initial identity checks, none of the masking, blocking, or recording would occur.

Practical steps to protect phi with subagents

  • Classify your data. Identify which tables, columns, or files contain phi and tag them in your data‑catalog.
  • Define masking policies. In the hoop.dev console you can specify patterns – for example, redact all Social Security Numbers or replace patient names with "REDACTED".
  • Enable just‑in‑time approval for high‑risk queries. Configure a workflow that requires a security officer to approve any SELECT that touches a PHI‑tagged column.
  • Turn on session recording for all subagent connections. The recorded logs become the source of truth for compliance evidence.
  • Deploy the gateway agent close to the target system so that network latency is minimal and the data‑path cannot be bypassed.

For a step‑by‑step walkthrough of the deployment process, see the getting‑started guide. The learn section contains deeper examples of masking rules and approval workflows.

FAQ

Q: What happens if a subagent is compromised?
A: hoop.dev continues to enforce the masking and command‑blocking policies because the enforcement lives in the gateway, not in the subagent’s code. Even a fully compromised process cannot retrieve raw phi unless an explicit approval is granted.

Q: Does hoop.dev store phi?
A: No. The gateway only proxies traffic and can redact or replace sensitive values. The original phi remains in the target system and never appears in the gateway’s storage.

Q: Can I integrate this with my CI/CD pipeline?
A: Yes. Deploy the gateway as part of your infrastructure stack and configure your build agents to connect through it. The same policies apply to automated jobs, ensuring that every deployment respects the phi protection rules.

Ready to see the code and contribute? Explore the open‑source repository on GitHub.

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