Dify DLP Needs Policy on the Model-Provider Request
Dify apps call configured model providers using workspace-managed connections, and Dify logs can expose full prompts, inputs, outputs, and node traces. A DLP design should enforce policy on the outbound model-provider request while assigning Dify logs, files, tools, and workflow execution to their proper control owners.

Dify states that every app runs on a model and that one AI response represents one model call. When a workspace connects its own provider account, Dify sends application context toward that provider under a workspace-managed connection. The outbound model request is the DLP enforcement point available to an HTTP policy gateway.
Dify's own logs serve a different purpose. They record application activity and can expose complete conversations and raw prompts, plus workflow inputs, outputs, tool iterations, and node traces. A credible DLP design keeps those records separate from the pre-transmission decision.
TL;DR
- Dify DLP should classify and enforce policy on the authenticated HTTP request sent from a Dify app to its model provider.
- The decision needs an originating user or agent and content classification, plus the provider route and policy version.
- Dify logs support application review but may contain full prompts and sensitive information after processing.
- Uploaded files and workflow execution retain separate control owners, as do tools, self-hosted infrastructure, provider credentials, and direct provider calls.
Dify creates a distinct provider-bound route
The Dify model-provider documentation says every Dify app runs on a model. Workspaces can use included AI credits or connect provider accounts and API keys. Models are shared across the workspace. Only workspace owners and admins manage providers. Dify also defines one AI response as one model call with one input and one output.
A Dify app can assemble user input and retrieved context, then add system instructions and workflow output before sending the provider request. The data decision belongs immediately before that transmission. The useful visual is a request inspector showing a customer case ID inside the final prompt while the provider route and initiating Dify session sit beside it.
A workspace API key tells the provider which configured account made the call. It rarely identifies the employee or agent behind an individual Dify interaction. The application identity has to travel with the approved route if policy depends on role, department, customer assignment, or delegated authority. The AI gateway architecture guide describes this identity-aware decision point on the HTTP model path.
Application logs contain sensitive operational detail
The Dify Logs documentation says logs capture activity from web apps and APIs, including activity started by triggers. Chat-based apps record conversations, while Workflow apps record runs. A reviewer can open full message threads and raw prompts, plus tool iterations, workflow inputs and outputs, token totals, and node-by-node traces.
Dify warns that complete conversations may contain sensitive information. That warning should shape log access and retention, including export handling. It also shows why Dify logs and DLP decisions are separate artifacts: a full prompt stored after processing can support debugging, but it cannot retroactively prevent an unapproved value from reaching the model provider.
I would require the pre-transmission decision to retain a protected reference to the matched span instead of copying the secret into another log. The AI audit trail guide covers the evidence fields needed for an independent request decision.
Policy needs the context assembled before the call
A Dify route can combine several data sources in one provider request. The user's message may be permitted in isolation. Retrieved customer text or a workflow variable can change the classification of the final prompt. Policy therefore needs to evaluate the assembled model input, including content added after the first message typed into a web form.
The decision should include:
- Originating principal: the authenticated user or service supplied for this Dify interaction, including a delegated agent.
- Application context: the Dify app or workflow responsible for the provider-bound model call.
- Content classification: the data classes and matched spans found in the final model input.
- Destination: the configured provider and model route selected for the call.
- Policy state: the active rule version and decision, plus the exception reference and timestamp.
Policy can forward or stop a request. Under an approved rule, it can also redact only the matched content before forwarding. Each action records the reason. The model provider's own response can pass through the same routed transaction for output classification and policy review.
Identity must be supplied. If an API-triggered workflow carries only a session ID, policy can evaluate that session and service context, but it cannot invent a natural person. That limitation belongs in the control record rather than being hidden behind a generic workspace identity.
A two-request test proves the enforcement point
Build a Dify test app with an approved provider route and a synthetic customer identifier in one controlled input. Send the first request under a role that policy permits after redaction. Send the second under a role that lacks authorization for that data class. Preserve the Dify conversation or run ID and the gateway correlation identifier, along with any provider request identifier created for the forwarded call.
The allowed or redacted request should appear in the routed decision record and Dify's application log, with provider telemetry confirming the forwarded call. The denied request should appear in Dify's initiating context and the policy record while producing no provider call. A reviewer can put the Dify log and policy record beside the provider telemetry to see where each event stopped.
Inspect the Dify log after the test, then verify which prompt fields and workflow input, output, trace, or tool-iteration fields were retained. Apply the workspace's access and retention rules to that content. Then confirm the DLP record stores only the evidence required for review, such as a fingerprint or protected reference to the matched value.
Repeat this test when the Dify app changes its provider or model, retrieval source, workflow graph, or identity integration. The prompt DLP guide explains why the final assembled prompt is the enforcement object rather than the originating file or form field alone.
Dify controls keep their own owners
Dify log retention and uploaded files sit outside the model-request policy decision, as do workflow archives, provider-key administration, tool permissions, and self-hosted infrastructure. Provider connections and log access belong to workspace administrators. Workflow composition and tool behavior belong to application owners. Self-hosted services and egress belong to platform teams. Permitted data classes for each model route belong to data owners.
The HTTP DLP boundary covers model calls deliberately routed through the policy point. A direct provider request that bypasses that route stays invisible to it. Network egress should restrict model access to the approved path. Credential controls should prevent unapproved applications from reusing provider keys.
A Dify node trace can explain how content entered the assembled prompt. The policy record explains the decision, including any change made before transmission. Provider telemetry confirms receipt of calls that crossed the boundary.
DeepInspect
DeepInspect sits on the approved HTTP route between a Dify app and its model provider. Dify or the calling application supplies identity and app context. DeepInspect classifies the assembled request and evaluates per-role and per-route policy. It can forward or block the request. Under an approved rule, it can redact matched content before the provider receives it.
Each decision records the principal and app, data class, destination, policy version, outcome, and correlation identifier. Dify logs remain application records, while provider telemetry confirms forwarded calls. Uploaded files and tools stay with their existing owners, along with workflow execution, provider credentials, and bypass prevention.
Book a technical deep dive at deepinspect.ai.
Frequently asked questions
- Does Dify record prompts and workflow runs?
Dify documents conversation logs for chat-based apps and run logs for Workflow apps. Reviewers can inspect full message threads and raw prompts, along with workflow inputs and outputs, token totals, tool iterations, and node traces. Dify warns that complete conversations may include sensitive information.
- Where should Dify DLP run?
It should run on the provider-bound HTTP model request after Dify has assembled the final input and before the provider receives it. That placement allows policy to evaluate the actual prompt and originating identity together with the app context and selected destination.
- Can Dify logs replace a pre-send DLP decision?
Dify logs support debugging and forensic review after application activity occurs. A pre-send decision can stop or redact sensitive content before provider transmission. It also preserves the exact policy outcome under an independent correlation identifier.
- What identity should a Dify policy use?
Use the authenticated user or service supplied by the calling path, including a delegated agent. For web or API activity represented only by a session ID, record that limitation. Policy should never infer a named person from missing context.
- Does this cover Dify tools and workflow actions?
The model-provider HTTP request is the covered boundary. Tool execution and file handling need their own controls. Workflow state, local processes, external actions, and tool permissions also remain outside that boundary. Their outputs can still enter a later model request, where prompt classification evaluates the assembled content.