From 971f09abe486185247e1faf4e8d1419ba2506b8d Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Thu, 23 May 2024 00:03:35 +0200 Subject: fix(runtime): use more null proto objects (#23921) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a primordialization effort to improve resistance against users tampering with the global `Object` prototype. --------- Co-authored-by: Bartek IwaƄczuk --- ext/kv/01_db.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/kv') diff --git a/ext/kv/01_db.ts b/ext/kv/01_db.ts index 8917e09e0..9aa2036dd 100644 --- a/ext/kv/01_db.ts +++ b/ext/kv/01_db.ts @@ -210,7 +210,7 @@ class Kv { cursor?: string; reverse?: boolean; consistency?: Deno.KvConsistencyLevel; - } = {}, + } = { __proto__: null }, ): KvListIterator { if (options.limit !== undefined && options.limit <= 0) { throw new Error("limit must be positive"); @@ -340,7 +340,7 @@ class Kv { finishMessageOps.clear(); } - watch(keys: Deno.KvKey[], options = {}) { + watch(keys: Deno.KvKey[], options = { __proto__: null }) { const raw = options.raw ?? false; const rid = op_kv_watch(this.#rid, keys); const lastEntries: (Deno.KvEntryMaybe | undefined)[] = ArrayFrom( -- cgit v1.2.3