« get me outta code hell

client: initInfo: prevent extensions on special clientInfo keys - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-12-29 16:32:39 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-12-29 16:33:45 -0400
commit69dfb9ba591ac76a23ecbec4b550bb20f83202a9 (patch)
treeeff2ead881e4c5d14d8483115d5099531e74dce6
parentdbc8d7b9a632fa47cec7a8d37aaa8c4efd871405 (diff)
client: initInfo: prevent extensions on special clientInfo keys
As well as clientInfo itself.
-rw-r--r--src/static/client3.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/static/client3.js b/src/static/client3.js
index b710b2bd..4dab19d1 100644
--- a/src/static/client3.js
+++ b/src/static/client3.js
@@ -22,6 +22,16 @@ const clientSteps = {
 function initInfo(key, description) {
   const object = {...description};
 
+  for (const obj of [
+    object,
+    object.state,
+    object.setting,
+    object.event,
+  ]) {
+    if (!obj) continue;
+    Object.preventExtensions(obj);
+  }
+
   clientInfo[key] = object;
 
   return object;