Data masking after xml-to-json policy

We have an API which contains sensitive data, so we have enabled data masking. It has been successful in almost all locations where we've requested the values to be masked. One location we're having difficulty with. The target response is SOAP. One masking entry we added is this:

<XPathsResponse> 
  <XPathResponse>/soapenv:Envelope/soapenv:Body/p456:findIssuedGiftCardByGiftCardNumberResponse/p456:findIssuedGiftCardByGiftCardNumberReturn/p176:giftCard/p176:cardNumber</XPathResponse> 
  <XPathResponse>/soapenv:Envelope/soapenv:Body/p456:findIssuedGiftCardByGiftCardNumberResponse/p456:findIssuedGiftCardByGiftCardNumberReturn/p176:giftCard/p176:cardPinNumber</XPathResponse> 
</XPathsResponse>

But after our xml-to-json policy, the payload is JSON and therefore the XPath data mask will not apply. The trace is showing the sensitive values. I tried doing the following (please note that the namespaces above are being stripped off by the xml-to-json policy):

<JSONPathsResponse>
  <JSONPathResponse>$.Envelope.Body.findIssuedGiftCardByGiftCardNumberResponse.findIssuedGiftCardByGiftCardNumberReturn.cardNumber</JSONPathResponse> 
  <JSONPathResponse>$.Envelope.Body.findIssuedGiftCardByGiftCardNumberResponse.findIssuedGiftCardByGiftCardNumberReturn.cardPinNumber</JSONPathResponse> 
</JSONPathsResponse>

...but this doesn't seem to work. I have also tried accessing/setting using a variable entry, but that doesn't seem to work either.

1 5 594
5 REPLIES 5

Former Community Member
Not applicable

@arghya das any ideas?

I am able to reproduce the same issue, looks to be a valid usecase - I will file a bug for this, can you pls report a support ticket?

@mukundha@apigee.com: I created support ticket 868026 to track this. Do you have the internal bug ticket for future reference?

Issue reproduced, filed Bug- 'MGMT-2382'

Hi @Sean Case,

I think we found the root cause, and we have a workaround

After XMLtoJSON, for JSONPath to work you need add '.content' to the variable, for eg,

<JSONPathResponse>$.Envelope.Body.findIssuedGiftCardByGiftCardNumberResponse.findIssuedGiftCardByGiftCardNumberReturn.cardNumber.content</JSONPathResponse>

Let me know if it works for you

Thanks,