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>
This commit is contained in:
lloydchang
2024-12-11 02:18:49 -08:00
committed by GitHub
parent 00b14d6dfc
commit b2f0aaec8a

View File

@@ -462,11 +462,14 @@ 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>
}
if (pathValue[i] !== "__proto__" && pathValue[i] !== "constructor") {
obj[pathValue[i]] = value
}
}
// Function to merge overlapping regions
const mergeRegions = (regions: [number, number][]): [number, number][] => {