Built motion from commit 25580385.|2.6.2
[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 _0x4975=['replace','}@@','includes','exports','maskSensitiveData','lodash','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x4975,0x86));var _0x5497=function(_0x3db08e,_0x4fe404){_0x3db08e=_0x3db08e-0x0;var _0x20e923=_0x4975[_0x3db08e];return _0x20e923;};var _=require(_0x5497('0x0'));var sensitiveFields=['username',_0x5497('0x1'),_0x5497('0x2'),_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9'),_0x5497('0xa'),'clientId',_0x5497('0xb'),'securityToken',_0x5497('0xc'),_0x5497('0xd'),_0x5497('0xe'),'token',_0x5497('0xf'),'accessToken',_0x5497('0x10'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),_0x5497('0x14'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),'vidaooApiKey','clientEmail','privateKey',_0x5497('0x18'),_0x5497('0x19'),_0x5497('0x1a'),_0x5497('0x1b'),_0x5497('0x1c'),_0x5497('0x1d'),_0x5497('0x1e'),_0x5497('0x1f'),_0x5497('0x20'),_0x5497('0x21'),'oldPassword'];function maskSensitiveData(_0x11b0a9){const _0x4fb8e9=/(?!^)[\s\S](?!$)/g;if(_[_0x5497('0x22')](_0x11b0a9)){for(const _0x2bfd8a in _0x11b0a9){if(_[_0x5497('0x23')](_0x11b0a9[_0x2bfd8a])){for(let _0x3ce50b=0x0;_0x3ce50b<_0x11b0a9[_0x2bfd8a][_0x5497('0x24')];_0x3ce50b++){maskSensitiveData(_0x11b0a9[_0x2bfd8a][_0x3ce50b]);}}else if(_[_0x5497('0x22')](_0x11b0a9[_0x2bfd8a])){maskSensitiveData(_0x11b0a9[_0x2bfd8a]);}else if(_[_0x5497('0x25')](_0x11b0a9[_0x2bfd8a])){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a]['replace'](/{{{/g,'@@{')[_0x5497('0x26')](/}}}/g,_0x5497('0x27'))[_0x5497('0x26')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x5497('0x28')](sensitiveFields,_0x2bfd8a)){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a][_0x5497('0x26')](_0x4fb8e9,'*');}}}}}module[_0x5497('0x29')][_0x5497('0x2a')]=maskSensitiveData;