-
Notifications
You must be signed in to change notification settings - Fork 0
/
integrity_check.js
3 lines (2 loc) · 1.42 KB
/
integrity_check.js
1
2
3
!function(){let e=()=>{throw"This function should not be called"};function t(e){return!0!==e.configurable&&!0!==e.writable&&"function"!=typeof e.set}function n(t,n=t.name){if("string"!=typeof n)throw"Expected name must be a string";if(!function(t){let n=t.name;if("string"!=typeof n)return!1;let r=" \r\n !\"#%&'()*+,-./:;<=>?@[\\]^`{|}~";for(let e=0;e<n.length;e++){let t=n[e];for(let e=0;e<r.length;e++)if(t===r[e])return!1}return((e,t)=>{let n=0,r=0;for(;n<e.length;){let o=e[n],l=0;for(;l<o.length&&r<t.length;){let e=o[l],n=t[r];if(e===n)l++,r++;else{if(0!==l&&l!==o.length||" "!==n&&" "!==n&&"\n"!==n&&"\r"!==n)return!1;r++}}if(l!==o.length)return!1;n++}return!0})(["function ",t.name,"()","{","[native code]","}"],e.toString.call(t))}(t))throw`Function ${t.name} is user-defined and cannot be trusted`;if(t.name!==n)throw`Function ${n} has been tampered with and cannot be trusted`}!function(){n(Object,"Object"),n(Object.getOwnPropertyDescriptors,"getOwnPropertyDescriptors"),n(Object.values,"values");let e=[];n(e.push,"push"),e.push(Object.getOwnPropertyDescriptors(globalThis));let r=0;for(;r<e.length;){var o;let l=e[r++],i=null!==(o=l.value)&&void 0!==o?o:{},f="function"==typeof i,s="object"==typeof i;if(f||s){for(let e of Object.values(Object.getOwnPropertyDescriptors(i)))e&&!t(e)&&console.error("Property is not frozen",e);f&&n(i)}else t(l)||console.error("Property is not frozen",l)}}()}();
//# sourceMappingURL=integrity_check.js.map