How to hide the sensitive information in postman

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

I have a xml response with sensitive information. I want to hide this information from others to view in my test report. How do i achieve it?

Hey @jency.stella19

Welcome to the community! :wave:

How are you creating the test report?

Hi @danny-dainton using the below coomand
newman run collection.json -r htmlextra

That’s a wonderful reporter… :heart:

So you could use the --reporter-htmlextra-hideResponseBody flag on the latest version to hide the response of a particular request, in the final report.

For example:

newman run collection.json -r htmlextra --reporter-htmlextra-hideResponseBody "Auth Request"
3 Likes

@danny-dainton: Is it possible to hide/encrypt particular response tag alone, just because it has some private information?

Not currently but it is something that I’ve taken a look at and I have an open FR for:

It’s easy to hide the full response because you can trigger that on a particular request but it’s super difficult when it’s an individual part of a response body.

You would need to parse all the data, which could be huge, to mask or hide a single part.

It’s even crazier because you also need to account for all the different types of responses their could be XML, JSON, plain text etc.

1 Like

@danny-dainton Thank you :slight_smile: I tried to use the snippet you shared for the making.

//masking

let maskValue = '*******',

    ld = require('lodash');

let masker = ld.cloneDeepWith(jsonObject, (value, key) => {

    if (ld.some(['ns2:CountryCode', 'ns2:Uci', 'ns2:LocalCustomerId'], item => ld.toLower(key) === ld.toLower(item))) {

        return maskValue;

    }

    if (ld.isObject(value)) {

        return;

    }

    return value;

})

console.log(masker); 

its working. same logic wen used for JSON response I can directly access the nodes by console.log(masker.fieldname);

but for the XML response any way to reach the masked node directly?

That was a basic example of what I created to mask something on the console.log() for a JSON response - It doesn’t change the response in anyway, it’s just showing that masked value for a certain key in the response.

Thanks @danny-dainton the post was quite useful

1 Like

Hi Danny,

I am having PII (Personally Identifiable Information) in the form of base64 strings in both the request and response bodies of the Postman Collection. I have integrated Postman and TestRail. I am posting the test results into the TestRail Test Runs using the Newman command as shown here.

newman run postman-collection.json -d options.csv -r htmlextra --reporter-htmlextra-hideResponseBody --reporter-htmlextra-hideRequestBody “Auth Request” --reporters cli,testrail

However, the test results in the TestRail Test Run still contain the base64 strings with PII in it. These Test Results can be accessed by anybody in the company who has access to TestRail. Is it possible to suppress the whole of request and response bodies while the results are written into TestRail.

Regards
Suren Das

There isn’t any functionality in the reporter to hide/suppress the Test Results.

In what form is this coming through? Do you use it in the Test Name?

There isn’t a bunch of data points in the Tests apart from the Test Name - You could see that PII in the output if the test failed and the assertion contains it.

Just want to get a better understanding of which part is failing for you.

Is there anyway to mask request query parameters? API keys, in specific cases, are passed as query parameters. So far, I can hide header info, but not query parameters. I have to parse response and replace strings.

You can try to store them as variables

Hi Danny, could you please share the method to hide the full response in a request? I have a request to get access token and would like to hide that response in the cli report

In terms of the htmlextra reporter, there a several flags available to do multiple things to the final report.

This would allow you to hide the response body for a specific request:

newman run collection.json -r htmlextra --reporter-htmlextra-hideResponseBody "Auth Request"
1 Like