Comparing version 0.0.126 to 0.0.127
{ | ||
"name": "webdetta", | ||
"version": "0.0.126", | ||
"version": "0.0.127", | ||
"author": "Fedot Kriutchenko <fodyadev@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "", |
@@ -45,17 +45,18 @@ import { parseFn } from './common.js'; | ||
}); | ||
const stateValue = (handlerId, initial, sync) => { | ||
const init = [ | ||
const syncValue = (handlerId, initial, allowRead, allowWrite) => { | ||
const vars = [ | ||
`const V = this["#internals"].state ??= {};`, | ||
`const H = ${JSON.stringify(handlerId)};`, | ||
`if (!(H in V)) V[H] = ${JSON.stringify(initial)};`, | ||
`const H = ${JSON.stringify(handlerId)};` | ||
].join(''); | ||
const init = | ||
`if (!(H in V)) V[H] = ${JSON.stringify(initial)};`; | ||
return { | ||
rpcHandler: !sync ? null : new Function('...a', | ||
init + `return a.length > 0 ? (V[H] = a[0]) : V[H];` | ||
rpcHandler: !allowRead ? null : new Function('...a', | ||
vars + init + `return a.length > 0 ? (V[H] = a[0]) : V[H];` | ||
), | ||
instanceProperty: { | ||
get: new Function(init + `return V[H];`), | ||
get: new Function(vars + init + `return V[H];`), | ||
set: new Function('value', ( | ||
(init + `V[H] = value;`) + | ||
(!sync ? '' : `this["#internals"].rpc.cast(H, value);`) | ||
(vars + `V[H] = value;`) + | ||
(!allowWrite ? '' : `this["#internals"].rpc.cast(H, value);`) | ||
)), | ||
@@ -90,12 +91,12 @@ } | ||
Client: SdkEntry((initial) => ({ | ||
client: (handlerId) => stateValue(handlerId, initial, false), | ||
server: null | ||
client: (handlerId) => syncValue(handlerId, initial, false, true), | ||
server: (handlerId) => syncValue(handlerId, initial, true, false), | ||
})), | ||
Server: SdkEntry((initial) => ({ | ||
client: null, | ||
server: (handlerId) => stateValue(handlerId, initial, false) | ||
client: (handlerId) => syncValue(handlerId, initial, true, false), | ||
server: (handlerId) => syncValue(handlerId, initial, false, true) | ||
})), | ||
Sync: SdkEntry((initial) => ({ | ||
client: (handlerId) => stateValue(handlerId, initial, true), | ||
server: (handlerId) => stateValue(handlerId, initial, true) | ||
client: (handlerId) => syncValue(handlerId, initial, true, true), | ||
server: (handlerId) => syncValue(handlerId, initial, true, true) | ||
})) | ||
@@ -102,0 +103,0 @@ }; |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
106773
3134