Data Masking

Data Masking is a technique where sensitive data is obscured to render it safe to protect the actual data. Which the policy achieves by having a functional substitute for occasions when the real data is not necessary.

This policy is used to mask sensitive data at the application level. At the application level, you must configure an Identify and Access policy to identify the application for which the masking is applied. If no application is specified, then the policy is applied for all the other requests. Fields can be masked or filtered in the request messages received. You can configure the masking criteria for the XPath, JSONPath, and Regex expressions based on the content type.

In API Studio, the kind DataMasking identifies the policy.

Sample code for the Data Masking policy.

kind: DataMasking
apiVersion: api.webmethods.io/beta
metadata:
  name: request_datamasking
  version: 1.0
  namespace: sample
spec:
  enabled: false
  matchApplications:
    - consumer1
    - consumer2
  transformations:
      set:
          - jpath: '$.customer.name'
            maskValue: ****
          - xpath: '$.customer.name'
            namespaces:
            - prefix: ''
              URI: ''
            maskValue: ****
          - regex: '$.customer.name'
            maskValue: ****
      remove:
          - jpath: {request}
          - xpath: {request}
          - regex: {request}
  applyForTransactionLogging: true
  applyForPayload: true

The structure in the code view and what it denotes is as follows.

Type Description
kind DataMasking.

The kind denotes the asset type, which is, Data Masking policy.

apiVersion Denotes the API version of the API on which this policy is enforced.
metadata Denotes the metadata or details of the asset type.
It covers the following metadata:
  • name. Name of the policy.
  • version. Version of the policy.
  • namespace. The namespace identifier for the policy.
  • tags. The tags associated with the policy.
spec The spec denotes various policy properties that you can configure for the policy.
You can configure the following policy properties:
  • Enabled. Specifies whether the policy is enabled or not. You can disable the policy by setting this property as false.
  • matchApplications. Specifies the applications for which the masking criterion must be applied.
  • transformations. You can apply the following transformations:
    • set. Specifies the request payload transformation to be configured for incoming requests. This spec is a key value pair. Provide the key as a variable type with syntax. Provide the value as a plain value or value with a syntax. You can provide multiple key value pairs.
    • remove.
  • applyForTransactionLogging. Specifies whether the data masking criterion is applied to transaction logging.
  • applyForPayload. Specifies whether the data masking criterion is applied to request payload.