Built motion from commit 2b9af5da.|2.6.26
[motion2.git] / server / utils / mask-sensitive-data.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x1261=['fax','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','oldPassword','length','isPlainObject','replace','@@{','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile'];(function(_0x13d048,_0x361fc8){var _0x35b544=function(_0x425c5b){while(--_0x425c5b){_0x13d048['push'](_0x13d048['shift']());}};_0x35b544(++_0x361fc8);}(_0x1261,0x144));var _0x1126=function(_0x306626,_0x425e93){_0x306626=_0x306626-0x0;var _0x466728=_0x1261[_0x306626];return _0x466728;};var _=require('lodash');var sensitiveFields=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2'),_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'email','clientId',_0x1126('0xa'),_0x1126('0xb'),'code',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'accessTokenSecret',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'membername',_0x1126('0x14'),'calleridnum','exten',_0x1126('0x15'),'clientEmail',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'secret','registry',_0x1126('0x1f')];function maskSensitiveData(_0x154e20){const _0x279455=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x154e20)){for(const _0x45149c in _0x154e20){if(_['isArray'](_0x154e20[_0x45149c])){for(let _0x35fe9f=0x0;_0x35fe9f<_0x154e20[_0x45149c][_0x1126('0x20')];_0x35fe9f++){maskSensitiveData(_0x154e20[_0x45149c][_0x35fe9f]);}}else if(_[_0x1126('0x21')](_0x154e20[_0x45149c])){maskSensitiveData(_0x154e20[_0x45149c]);}else if(_['isString'](_0x154e20[_0x45149c])){_0x154e20[_0x45149c]=_0x154e20[_0x45149c][_0x1126('0x22')](/{{{/g,_0x1126('0x23'))['replace'](/}}}/g,'}@@')[_0x1126('0x22')](/{{/g,'@{')[_0x1126('0x22')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x45149c)){_0x154e20[_0x45149c]=_0x154e20[_0x45149c]['replace'](_0x279455,'*');}}}}}module[_0x1126('0x24')]['maskSensitiveData']=maskSensitiveData;