X-Git-Url: https://git.josue.xyz/?p=dotfiles%2F.git;a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Fconfigstore%2Fnode_modules%2Fdot-prop%2Findex.js;h=189831cf00f81d0d2d8359c354aef70747410e7a;hp=15282bb392402ed8bae316ed244671c9aa265952;hb=4d07c77cf4d78cab8639e13ddc3c22495e585b0b;hpb=b3950616b54221c40a7dab9099bda675007e5b6e diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/configstore/node_modules/dot-prop/index.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/configstore/node_modules/dot-prop/index.js index 15282bb3..189831cf 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/configstore/node_modules/dot-prop/index.js +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/configstore/node_modules/dot-prop/index.js @@ -1,6 +1,14 @@ 'use strict'; const isObj = require('is-obj'); +const disallowedKeys = [ + '__proto__', + 'prototype', + 'constructor' +]; + +const isValidPath = pathSegments => !pathSegments.some(segment => disallowedKeys.includes(segment)); + function getPathSegments(path) { const pathArr = path.split('.'); const parts = []; @@ -16,6 +24,10 @@ function getPathSegments(path) { parts.push(p); } + if (!isValidPath(parts)) { + return []; + } + return parts; } @@ -26,6 +38,9 @@ module.exports = { } const pathArr = getPathSegments(path); + if (pathArr.length === 0) { + return; + } for (let i = 0; i < pathArr.length; i++) { if (!Object.prototype.propertyIsEnumerable.call(obj, pathArr[i])) { @@ -58,6 +73,9 @@ module.exports = { const root = obj; const pathArr = getPathSegments(path); + if (pathArr.length === 0) { + return; + } for (let i = 0; i < pathArr.length; i++) { const p = pathArr[i];