API Gateway 10.5 | Using API Gateway | Policies | System-defined Stages and Policies | Response Processing | Data Masking
 
Data Masking
Data masking is a technique whereby sensitive data is obscured in some way to render it safe and to protect the actual data while having a functional substitute for occasions when the real data is not required.
This policy is used to mask sensitive data at the application level. At the application level you must have an Identify and Access policy configured to identify the application for which the masking is applied. If no application is specified then it will be applied for all the other responses. Fields can be masked or filtered in the response messages to be sent. You can configure the masking criteria as required for the XPath, JSONPath, and Regex expressions based on the content-types. This policy can also be applied at the API scope level.
The table lists the content-type and masking criteria mapping.
Content-type
Masking Criteria
application/xml
text/xml
text/html
XPath
application/json
application/json/badgerfish
JSONPath
text/plain
Regex
The table lists the masking criteria properties that you can configure to mask the data in the response messages:
Parameter
Description
Consumer Applications
Optional. Specifies the applications for which the masking criterion has to be applied.
Start typing the application name, select the application from the type-ahead search results displayed, and click to add one or more applications.
For example: If there is a DataMasking(DM1) criteria created for application1 a second DataMasking(DM2) for application2 and a third DataMasking(DM3) with out any application, then for a request that comes from consumer1 the masking criteria DM1 is applied, for a request that comes from consumer2 DM2 is applied. If a request comes with out any application or from any other application except application1 and application2 DM3 is applied.
You can use the delete icon to delete the added applications from the list.
XPath: Specifies the masking criteria for XPath expressions in the response messages.
Masking Criteria
Click Add masking criteria and provide the following information and click Add:
*Query expression. Specify the query expression that has to be masked or filtered.
For example: /pet/details/status, /user/details/card/ccnumber.
*Masking Type. Specifies the type of masking required. You select either Mask or Filter. Selecting Mask replaces the value with the given value (the default value being ********). Selecting Filter removes the field completely.
*Mask Value. This is available if masking type selected is Mask. Provide a mask value. For example: sold, any mask value #####.
Note:
You can add multiple masking criteria.
*Namespace. Specifies the following Namespace information:
*Namespace Prefix. The namespace prefix of the payload expression to be validated.
*Namespace URI. The namespace URI of the payload expression to be validated
Note:
You can add multiple namespace prefix and URI by clicking .
JSONPath. This is applicable only for REST API. Specifies the masking criteria for JSONPath expressions in the response messages.
Masking Criteria
Click Add masking criteria and provide the following information and click Add:
*Query expression. Specify the query expression that has to be masked or filtered. For example: $.pet.details.status.
*Masking Type. Specifies the type of masking required. You select either Mask or Filter. Selecting Mask replaces the value with the given value (the default value being ********). Selecting Filter removes the field completely.
*Mask Value. This is available if masking type selected is Mask. Provide a mask value. For example: sold
Regex. Specifies the masking criteria for regular expressions in the response messages.
Masking Criteria
Click Add masking criteria and provide the following information and click Add:
*Query expression. Specify the query expression that has to be masked or filtered. For example: [0-9]+.
*Masking Type. Specifies the type of masking required. You select either Mask or Filter. Selecting Mask replaces the value with the given value (the default value being ********). Selecting Filter removes the field completely.
*Mask Value. This is available if masking type selected is Mask. Provide a mask value. For example: ######## .
Apply for transaction Logging
Select this option to apply masking criteria for transactional logs.
When you select this option the transactional log for the response is masked on top of response sent to the client.
Apply for payload
Select this option to apply masking criteria for response payload in the following scenarios:
*response received from the native service.
*response sent to the client.
Note:
When you select this option it automatically masks the data in the transactional log.