mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Enhance occurrenceIndex validation in applyDashboardPatches to ensure it is a valid integer and within bounds
This commit is contained in:
parent
7e850dbe60
commit
7527bcfb9d
@ -98,7 +98,11 @@ export function applyDashboardPatches(source: string, edits: DashboardPatchEdit[
|
||||
|
||||
let chosenIndex: number;
|
||||
if (edit.occurrenceIndex != null) {
|
||||
if (edit.occurrenceIndex < 0 || edit.occurrenceIndex >= matches.length) {
|
||||
if (
|
||||
!Number.isInteger(edit.occurrenceIndex)
|
||||
|| edit.occurrenceIndex < 0
|
||||
|| edit.occurrenceIndex >= matches.length
|
||||
) {
|
||||
failures.push({ index, reason: "not-found", oldTextPreview: preview });
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user