From 83a8003018c60438c4eb61ba1bf78a23a8fca8dc Mon Sep 17 00:00:00 2001 From: Chris Reddington <791642+chrisreddington@users.noreply.github.com> Date: Wed, 30 Jul 2025 11:11:12 +0100 Subject: [PATCH] Potential fix for code scanning alert no. 1: Prototype-polluting assignment Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- shared/src/games/tic-tac-toe.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/shared/src/games/tic-tac-toe.ts b/shared/src/games/tic-tac-toe.ts index 00a74b3..a73f010 100644 --- a/shared/src/games/tic-tac-toe.ts +++ b/shared/src/games/tic-tac-toe.ts @@ -41,8 +41,15 @@ export class TicTacToeGame implements Game { return false; } - // Check if the move is within bounds - if (row < 0 || row >= 3 || col < 0 || col >= 3) { + // Check that row and col are numbers, integers, and not special property names + if ( + typeof row !== 'number' || + typeof col !== 'number' || + !Number.isInteger(row) || + !Number.isInteger(col) || + row < 0 || row >= 3 || + col < 0 || col >= 3 + ) { return false; }