Skip to content

Commit

Permalink
Fix code scanning alert no. 1: Prototype-polluting function
Browse files Browse the repository at this point in the history
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Félix C. Morency <[email protected]>
  • Loading branch information
fmorency and github-advanced-security[bot] authored Nov 25, 2024
1 parent 9f6763b commit d5f1e0a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/groups/forms/proposals/ProposalMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,12 @@ export default function ProposalMessages({

let current = updatedMessage;
for (let i = 0; i < fieldPath.length - 1; i++) {
if (fieldPath[i] === '__proto__' || fieldPath[i] === 'constructor') return;
current = current[fieldPath[i]];
}
current[fieldPath[fieldPath.length - 1]] = value;
if (fieldPath[fieldPath.length - 1] !== '__proto__' && fieldPath[fieldPath.length - 1] !== 'constructor') {
current[fieldPath[fieldPath.length - 1]] = value;
}

dispatch({ type: 'UPDATE_MESSAGE', index, message: updatedMessage });
};
Expand Down

0 comments on commit d5f1e0a

Please sign in to comment.