Browse Source

Merge pull request #67 from RooVetGit/alert-autofix-2

Fix code scanning alert no. 2: Prototype-polluting function
Matt Rubens 1 year ago
parent
commit
70639ec0df
1 changed files with 4 additions and 1 deletions
  1. 4 1
      webview-ui/src/components/history/HistoryView.tsx

+ 4 - 1
webview-ui/src/components/history/HistoryView.tsx

@@ -462,10 +462,13 @@ export const highlight = (
 		let i: number
 
 		for (i = 0; i < pathValue.length - 1; i++) {
+			if (pathValue[i] === "__proto__" || pathValue[i] === "constructor") return
 			obj = obj[pathValue[i]] as Record<string, any>
 		}
 
-		obj[pathValue[i]] = value
+		if (pathValue[i] !== "__proto__" && pathValue[i] !== "constructor") {
+			obj[pathValue[i]] = value
+		}
 	}
 
 	// Function to merge overlapping regions