Skip to content

Commit b2f0aae

Browse files
Fix code scanning alert no. 2: Prototype-polluting function
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 00b14d6 commit b2f0aae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

webview-ui/src/components/history/HistoryView.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,13 @@ export const highlight = (
462462
let i: number
463463

464464
for (i = 0; i < pathValue.length - 1; i++) {
465+
if (pathValue[i] === "__proto__" || pathValue[i] === "constructor") return
465466
obj = obj[pathValue[i]] as Record<string, any>
466467
}
467468

468-
obj[pathValue[i]] = value
469+
if (pathValue[i] !== "__proto__" && pathValue[i] !== "constructor") {
470+
obj[pathValue[i]] = value
471+
}
469472
}
470473

471474
// Function to merge overlapping regions

0 commit comments

Comments
 (0)