diff --git a/core/embedjs/src/store/memory-store.ts b/core/embedjs/src/store/memory-store.ts index 11c3f905..19232d78 100644 --- a/core/embedjs/src/store/memory-store.ts +++ b/core/embedjs/src/store/memory-store.ts @@ -8,7 +8,7 @@ export class MemoryStore implements BaseStore { async init(): Promise { this.loaderList = {}; - this.loaderCustomValues = {}; + this.loaderCustomValues = Object.create(null); this.conversations = new Map(); this.loaderCustomValuesMap = new Map(); } @@ -37,6 +37,9 @@ export class MemoryStore implements BaseStore { } async loaderCustomGet>(key: string): Promise { + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + throw new Error("Invalid key"); + } const data = this.loaderCustomValues[key]; delete data.loaderId; return data;