![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/clinic.corals.io/node_modules/handlebars/lib/handlebars/internal/ |
import { createNewLookupObject } from './create-new-lookup-object'; import * as logger from '../logger'; const loggedProperties = Object.create(null); export function createProtoAccessControl(runtimeOptions) { let defaultMethodWhiteList = Object.create(null); defaultMethodWhiteList['constructor'] = false; defaultMethodWhiteList['__defineGetter__'] = false; defaultMethodWhiteList['__defineSetter__'] = false; defaultMethodWhiteList['__lookupGetter__'] = false; let defaultPropertyWhiteList = Object.create(null); // eslint-disable-next-line no-proto defaultPropertyWhiteList['__proto__'] = false; return { properties: { whitelist: createNewLookupObject( defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties ), defaultValue: runtimeOptions.allowProtoPropertiesByDefault }, methods: { whitelist: createNewLookupObject( defaultMethodWhiteList, runtimeOptions.allowedProtoMethods ), defaultValue: runtimeOptions.allowProtoMethodsByDefault } }; } export function resultIsAllowed(result, protoAccessControl, propertyName) { if (typeof result === 'function') { return checkWhiteList(protoAccessControl.methods, propertyName); } else { return checkWhiteList(protoAccessControl.properties, propertyName); } } function checkWhiteList(protoAccessControlForType, propertyName) { if (protoAccessControlForType.whitelist[propertyName] !== undefined) { return protoAccessControlForType.whitelist[propertyName] === true; } if (protoAccessControlForType.defaultValue !== undefined) { return protoAccessControlForType.defaultValue; } logUnexpecedPropertyAccessOnce(propertyName); return false; } function logUnexpecedPropertyAccessOnce(propertyName) { if (loggedProperties[propertyName] !== true) { loggedProperties[propertyName] = true; logger.log( 'error', `Handlebars: Access has been denied to resolve the property "${propertyName}" because it is not an "own property" of its parent.\n` + `You can add a runtime option to disable the check or this warning:\n` + `See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details` ); } } export function resetLoggedProperties() { Object.keys(loggedProperties).forEach(propertyName => { delete loggedProperties[propertyName]; }); }