Service Virtualization

  • 1.  How we can fetch value from json request and display it in response with special char ?

    Posted Aug 07, 2017 06:33 AM

    I have a json request, having 16 digit card number in it. Now i want to fetch this value from request and display it in response with last 4 digit visible and rest 12 digits will be replaced by special char. Lets say - "************0018".

     


    Need help in visualizing above scenario. please suggest. Attached sample request response file.

    Attachment(s)

    zip
    acc_info-rsp.txt.zip   248 B 1 version
    zip
    acc_info-req.txt.zip   275 B 1 version


  • 2.  Re: How we can fetch value from json request and display it in response with special char ?
    Best Answer

    Posted Aug 07, 2017 09:14 AM

    @Anzar,

    you can de-identification (formerly called desensitization) means attempting to recognize sensitive data and substituting random, but validly formatted.

    This de-identification program uses filters that ensure that sensitive information is never written to disk during the recording phase. The de-identify.xml file in the DevTest home directory configures data de-identifiers to recognize known patterns such as credit card numbers. The file replaces the live data with realistic but unusable replacements. The file uses Regex pattern matching to recognize and find sensitive data. This file is parsed each time that the recorder is started.

    All de-identification rules that are specified in LISA_HOME\de-identify.xml are applied. you can add new in case want different patter or the then one you want not exit there. 

     

    1) Dynamic de-identification: 

    De-identification is invoked by enabling the De-identify (transport layer) check box on the Basics tab of the Virtual Service Recorder.

    2) Static data de-identification: 

    Static data de-identification involves manually searching and replacing data in an existing service image.

    Hope this helps. 

    Thanks, 

    Rajesh k Singh



  • 3.  Re: How we can fetch value from json request and display it in response with special char ?

    Posted Aug 17, 2017 04:47 PM

    Anzar,

     

    One way of doing this is to use "match script" in the service image. You can access the value of the element that contains the credit card number and then replace the first 12 numbers with "*" through scripting. You then add the new semi-masked value into a property which you can dereference in your response payload.

     

    The script will look something along these lines:

    ================

    boolean operationsMatch = incomingRequest.getOperation().equals(sourceRequest.getOperation());
    if (operationsMatch) {
       String incomingCCValue = incomingRequest.getArguments().get("CreditCardElement");
       String maskedCCValue = "************" + incomingCCValue.substring(11, 15);
       testExec.setStateValue("maskedCCValue", maskedCCValue);

       return true;

    }
    return false;

    =================

     

    You can then parameterize your xml payload with the following property: {{maskedCCValue}}

     

    e.g.

     

    <mypayload>

      <creditcardinfo>

          <creditcard>{{maskedCCValue}}

      </creditcardinfo>

    </mypayload>



  • 4.  Re: How we can fetch value from json request and display it in response with special char ?

    Posted Aug 18, 2017 07:07 AM

    Anzar,

     

    Did Rajesh's and William's recommendations help you out with this issue?



  • 5.  Re: How we can fetch value from json request and display it in response with special char ?

    Posted Oct 27, 2017 05:59 PM

    Thanks all for your suggestions!!

    I have completed this activity using scripted DF and Regex in my script.