Data loss prevention (DLP)
Ensure that sensitive data isn’t logged or leaked by masking data in response bodies.
This feature is an Enterprise-only feature that requires a Gloo Gateway Enterprise license.
About data loss prevention
Data Loss Prevention (DLP) is a method of ensuring that sensitive data isn’t logged or leaked. Gloo Gateway accomplishes this by performing a series of regex replacements on the response body.
DLP for response bodies and headers
When you apply a DLP rule, Gloo Gateway completes a series of regex replacements on the body of each response that it processes. For example, consider the following response body that is returned to Gloo Gateway.
With DLP enabled, Gloo Gateway applies a transformation to the response that masks sensitive data.
DLP for access logs
DLP on access logs is currently not supported for Gloo Gateway in Kubernetes Gateway API mode.
Before you begin
Follow the Get started guide to install Gloo Gateway, set up a gateway resource, and deploy the httpbin sample app.
Get the external address of the gateway and save it in an environment variable.
Predefined actions for response bodies
Send a request to the httpbin app that returns a fake social security number and VISA credit card number in your response. Verify that the sensitive information is returned unmasked.
Example output:
Create a RouteOption resource to define your DLP rules. The following example uses DLP predefined actions to mask the credit card and social security numbers.
Create an HTTPRoute resource that exposes httpbin app on the
dlp.example
domain and applies the DLP rules that you defined.Send a request to the httpbin app on the
dlp.example
domain. Verify that the sensitive information is now masked.Example output:
Optional: Clean up the resources that you created.
Custom actions for response bodies
In this example, you mask data in responses by using a custom DLP action.
Send a request to the httpbin app along the
/json
path. Requests to this path return a slideshow example with attributes, such as the author, title, and slideshow items. Verify that you see theauthor
attribute unmasked.Example output:
Create a RouteOption resource to define your DLP rules. The following example creates a custom rule that captures the
author
in the response body and replaces the name of the author with_
characters.Create an HTTPRoute resource that exposes httpbin app on the
dlp.example
domain and applies the DLP rules that you defined.Send a request to the httpbin app on the
dlp.example
domain. Verify that the author is now masked.Example output:
Optional: Remove the resources that you created.