@itentialopensource/adapter-utils 5.10.15 → 5.10.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/propertyUtil.js +15 -8
- package/package.json +1 -1
package/lib/propertyUtil.js
CHANGED
|
@@ -1153,7 +1153,7 @@ class AdapterPropertyUtil {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
|
|
1155
1155
|
// This is the array of sensitive keys
|
|
1156
|
-
let sensList = ['authorization', 'x-auth-token', 'x-csrf-token', 'x-amz-security-token', 'x-aws-ec2-metadata-token', 'cookie', 'set-cookie', 'token', 'tokenp2', 'user', 'username', 'passwd', 'password', 'api-key', 'client-id', 'client-secret', 'client_id', 'client_secret', 'session', 'session-id', 'jsessionid', 'sessionToken', 'accessKeyId', 'secretAccessKey', 'private-token', 'ca'];
|
|
1156
|
+
let sensList = ['authorization', 'x-auth-token', 'x-csrf-token', 'x-amz-security-token', 'x-aws-ec2-metadata-token', 'cookie', 'set-cookie', 'token', 'tokenp2', 'user', 'username', 'passwd', 'password', 'api-key', 'client-id', 'client-secret', 'client_id', 'client_secret', 'session', 'session-id', 'jsessionid', 'sessionToken', 'accessKeyId', 'secretAccessKey', 'private-token', 'ca'].map((item) => item.toLowerCase());
|
|
1157
1157
|
|
|
1158
1158
|
// add any additional items to scrub
|
|
1159
1159
|
if (addItems && Array.isArray(addItems) && addItems.length > 0) {
|
|
@@ -1207,7 +1207,7 @@ class AdapterPropertyUtil {
|
|
|
1207
1207
|
|
|
1208
1208
|
// go through sensitive word list - maybe can use find in
|
|
1209
1209
|
for (let j = 0; j < sensList.length; j += 1) {
|
|
1210
|
-
if (key.toLowerCase() === sensList[j]
|
|
1210
|
+
if (key.toLowerCase() === sensList[j]) {
|
|
1211
1211
|
// if sensitive, mask
|
|
1212
1212
|
retData += `${key}=** masked **`;
|
|
1213
1213
|
found = true;
|
|
@@ -1229,12 +1229,19 @@ class AdapterPropertyUtil {
|
|
|
1229
1229
|
|
|
1230
1230
|
// want to make a copy and not alter the original object or array
|
|
1231
1231
|
const retData = JSON.parse(JSON.stringify(actualData));
|
|
1232
|
-
|
|
1232
|
+
if (retData && typeof retData.response === 'string') {
|
|
1233
|
+
try {
|
|
1234
|
+
const parsed = JSON.parse(retData.response);
|
|
1235
|
+
retData.response = parsed;
|
|
1236
|
+
} catch (e) {
|
|
1237
|
+
// ignore parse error
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1233
1240
|
// if we are scrubbing an array
|
|
1234
1241
|
if (Array.isArray(retData)) {
|
|
1235
1242
|
// need to go through each item in the array
|
|
1236
1243
|
for (let i = 0; i < retData.length; i += 1) {
|
|
1237
|
-
retData[i] = this.scrubSensitiveInfo(retData[i]);
|
|
1244
|
+
retData[i] = this.scrubSensitiveInfo(retData[i], addItems);
|
|
1238
1245
|
}
|
|
1239
1246
|
|
|
1240
1247
|
// return the scrubbed array
|
|
@@ -1253,18 +1260,18 @@ class AdapterPropertyUtil {
|
|
|
1253
1260
|
if (sensList.includes(key.toLowerCase())) {
|
|
1254
1261
|
retData[key][k] = '** masked **';
|
|
1255
1262
|
} else {
|
|
1256
|
-
retData[key][k] = this.scrubSensitiveInfo(retData[key][k]);
|
|
1263
|
+
retData[key][k] = this.scrubSensitiveInfo(retData[key][k], addItems);
|
|
1257
1264
|
}
|
|
1258
1265
|
}
|
|
1259
1266
|
} else {
|
|
1260
|
-
retData[key] = this.scrubSensitiveInfo(retData[key]);
|
|
1267
|
+
retData[key] = this.scrubSensitiveInfo(retData[key], addItems);
|
|
1261
1268
|
}
|
|
1262
1269
|
} else {
|
|
1263
1270
|
// go through sensitive word list - maybe can use find in
|
|
1264
1271
|
for (let j = 0; j < sensList.length; j += 1) {
|
|
1265
|
-
if (key.
|
|
1272
|
+
if (key.toLowerCase() === sensList[j]) {
|
|
1266
1273
|
// if sensitive, mask
|
|
1267
|
-
retData[key] = '
|
|
1274
|
+
retData[key] = '** masked **';
|
|
1268
1275
|
break;
|
|
1269
1276
|
}
|
|
1270
1277
|
}
|