Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/lib/node_modules/homebridge-config-ui-x/node_modules/fast-redact/lib/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict'
const { createContext, runInContext } = require('vm')
module.exports = validator
function validator (opts = {}) {
const {
ERR_PATHS_MUST_BE_STRINGS = () => 'fast-redact - Paths must be (non-empty) strings',
ERR_INVALID_PATH = (s) => `fast-redact – Invalid path (${s})`
} = opts
return function validate ({ paths }) {
paths.forEach((s) => {
if (typeof s !== 'string') {
throw Error(ERR_PATHS_MUST_BE_STRINGS())
}
try {
if (/〇/.test(s)) throw Error()
const proxy = new Proxy({}, { get: () => proxy, set: () => { throw Error() } })
const expr = (s[0] === '[' ? '' : '.') + s.replace(/^\*/, '〇').replace(/\.\*/g, '.〇').replace(/\[\*\]/g, '[〇]')
if (/\n|\r|;/.test(expr)) throw Error()
if (/\/\*/.test(expr)) throw Error()
runInContext(`
(function () {
'use strict'
o${expr}
if ([o${expr}].length !== 1) throw Error()
})()
`, createContext({ o: proxy, 〇: null }), {
codeGeneration: { strings: false, wasm: false }
})
} catch (e) {
throw Error(ERR_INVALID_PATH(s))
}
})
}
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0053 ]-- |