I am working on .net core c# logging project for my API response. The output is JSON format with the response contains sensitive info (eg. password)
I am stuck when the response output contains more complex Json structure with an array, whose items are complex objects, each with an "id" property and the keyword denoting the sensitive field, appears as value of that "id" field (see example below).
For the below output, How do I to replace the password value to 'XXXX' using RegEx if the value of the "id" contains the word 'password' . eg...there are value required to be masked below...
{
"type": "CatalogResourceRequest",
"description": null,
"reasons": null,
"data": {
"customProperties": [
{
"data": {
"id": "CloneFrom",
"is_hidden": false,
"value": "TMPLABC"
}
},
{
"data": {
"id": "Debug",
"is_hidden": false,
"value": false
}
},
{
"data": {
"id": "abc_password",
"is_hidden": false,
"value": "This_Is_Password_To_Be_Masked"
},
"data": {
"id": "password_of_user1",
"is_hidden": false,
"value": "This_Is_Password_To_Be_Masked_Also"
}
}
]
}
}