Implementation Guide | Healthcare

    How to Prevent an AI Agent from Copying PHI to SharePoint or Google Drive

    Treat it as a data-flow problem. Limit what the agent's identity can read in Snowflake or Postgres, separate or remove file-write tools from agents that touch PHI, and enforce policy at the tool call that writes the file, so each write is allowed, redacted, blocked or escalated before PHI leaves the governed store. Keep a record of every decision as audit evidence.

    What native controls cover, and where they stop

    Snowflake

    Masking policies and row access policies restrict what the service identity reads. Once a permitted value is returned, it sits in agent context with no further control over where it goes.

    Postgres

    Role grants, column privileges and row-level security limit rows and columns for the agent's role. They stop applying when the result leaves the database session.

    SharePoint and Google Drive

    Permissions, sharing settings, and DLP or sensitivity labels apply at the destination. They generally assess the file and the writing identity, not the query that produced the content.

    Agent framework

    Tool allow lists decide which tools an agent may call. They are coarse and rarely inspect the content or destination of an individual call.

    Map the path from query result to file write

    The risk sits in the gap between two systems that each behave correctly. A database grants an agent's service identity read access. A file platform grants a connector write access. Neither evaluates the decision the agent makes in between, which is to take rows it was allowed to read and put them somewhere it was allowed to write.

    Start by inventorying every tool that can read from Snowflake or Postgres and every tool that can write to SharePoint or Google Drive, including MCP servers, direct Microsoft Graph or Google Drive API calls, and file-write tools in the agent framework. Record the identity each tool runs under. Then pair them. Any agent holding both a read tool and a write tool has a live path.

    The path takes several forms: raw rows written to a spreadsheet or CSV export, a summary that still contains identifiers, content staged in an intermediate scratch file, and a file created and then shared. Each is a discrete copy of PHI, and each should be treated as an event to control and record. The January 2025 proposed amendments to the HIPAA Security Rule list copying ePHI as a covered activity. As of November 2026 that proposal is not binding, but it supports modelling the copy as its own event.

    Apply data, identity and tool controls first

    At the data layer, give each agent its own read-only service identity limited to the columns and rows its task needs. Mask direct identifiers by default, and prefer de-identified views where the task does not require PHI. The less PHI that reaches agent context, the less there is to copy.

    At the identity layer, never reuse one credential for reading and writing. Give the write connector the narrowest scope that works, restrict it to a named site or folder, and disable external sharing for that location. Avoid running an agent under a broad user's delegated credentials.

    At the tool layer, the strongest control is separation: agents that can read PHI do not receive file-write tools, and agents that write files do not receive database tools. Where a workflow genuinely needs both, constrain the write tool's parameters, such as permitted destinations and file formats. The remaining cases, where one agent legitimately holds both capabilities, are the ones that need runtime enforcement.

    Enforce policy at the tool call that writes the file

    The file-write call is the last point where the movement can be stopped before PHI lands outside the governed store. A policy engine in the execution path can evaluate each call before it executes. Useful conditions are the tool name, the destination system and path, the agent identity and the user it acts for, the data classification of the payload, and the volume of content.

    The rules are design choices your team defines per path. A workable starting set covers four outcomes.

    Trussed enforces policy in the execution path across agents, tools and MCP servers, with allow, redact, block, rate limit and escalate for human approval, at the level of individual interactions and tool calls. Because evaluation is per call, write rules so that a single call carries enough context to decide, and default to block when PHI is detected and the destination is not approved. Content classification is a detection step, so test it against realistic data.

    • Allow: The destination is approved for PHI, the identity is permitted, and the payload fits the task. Record the decision.
    • Redact: The destination is not approved for identifiers but the task is legitimate. Remove or mask PHI from the payload before the write proceeds.
    • Block: PHI is bound for an unapproved site, a shared or external location, or a bulk export. The write does not execute.
    • Escalate: The case is ambiguous or high impact. Hold the call until a named approver decides.

    Produce evidence that shows what was allowed and what happened

    Section 164.312(b) is the Audit Controls standard in the Security Rule's technical safeguards. Design the record so that a reviewer can see, for any file write, what the agent was permitted to do and what it did. Useful fields per tool call include the timestamp, agent identity, the user acting for it, tool name, destination, the policy version evaluated, the decision, the categories and counts of anything redacted, the approver and time for escalations, and the outcome.

    Keep PHI out of the evidence itself. Record categories and counts rather than values, so the audit trail does not become another uncontrolled copy of the data.

    These records also support the Security management process standard, which calls for policies and procedures to prevent, detect, contain and correct security violations, and the Privacy Rule requirement to reasonably safeguard PHI from intentional or unintentional disclosure. A blocked write is evidence of prevention. An escalation record shows a human decision. Trussed generates audit-ready evidence from enforcement, mapped to HIPAA, and supports self-managed deployment in the customer cloud with configurable retention and data residency, so the evidence stays in your environment.

    Tradeoffs and rollout

    Blocking has a cost. HealthIT.gov states that practices that interfere with access, exchange or use of electronic health information by automation technologies, including agentic AI, could implicate the information blocking regulations, and that exceptions exist. Document the basis for each restriction on agent access and check it against those exceptions, so protective controls are targeted and not blanket.

    Roll out in stages. Begin with the inventory and the separation of read and write tools, which need no new tooling. Then apply the data and identity changes. Add tool-call rules for the remaining paths, starting with escalation for ambiguous cases and block for clearly unapproved destinations. Test with synthetic records, review the decision records for false positives, and tighten from there.

    The layers are complementary. Native controls shrink the exposure, tool design removes avoidable paths, and enforcement at the call handles the paths that remain.

    The path to control

    Label: Governed store

    Description: PHI in Snowflake or Postgres, read under an agent service identity.

    Label: Agent context

    Description: Query results held by the agent, outside native database controls.

    Label: Tool call

    Description: The file-write request, where policy can allow, redact, block or escalate.

    Label: Destination

    Description: A SharePoint or Google Drive location with different access and retention.

    Enforce policy where the file write happens

    See how policy enforced in the execution path and audit-ready evidence apply to agent tool calls that touch PHI.

    Request a Demo
    Next step

    How does your AI governance program compare?

    See where your program has gaps in less than 2 minutes.