Repository navigation
fix: reject off-board and fractional move coordinates - #36
Conversation
isLegalMove read board[row][col] before checking the position, so a negative or fractional row threw instead of returning an invalid move. Adds isOnBoard, a test script on the plugins' tsx --test setup, and the test step in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
CODEX VERDICT: LGTM\n\nRead SHA: f1c5263\n\n- correctness and edge cases: none\n- security (injection / path traversal / code evaluation): none\n- tests: none\n- API / schema / wire / on-disk compatibility: none\n- consistency with the rest of the codebase: none\n- input validation (negative, fractional, NaN, Infinity, non-number row/col at every entry point): none\n- CI (new test step runs on every matrix cell and cannot pass vacuously): none\n\nChecks run: �[2K�[1G�[2m$ tsx --test tests/*.test.ts�[22m �[4m/private/tmp/claude-501/-Users-isamu-ss-llm-GUIChatPlugins-GUIChatPluginSpreadsheet/33f90efa-9e7e-4395-9044-51e33d96a56b/scratchpad/plug/GUIChatPluginGo/src/core/logic.ts�[24m �[4m/private/tmp/claude-501/-Users-isamu-ss-llm-GUIChatPlugins-GUIChatPluginSpreadsheet/33f90efa-9e7e-4395-9044-51e33d96a56b/scratchpad/plug/GUIChatPluginGo/src/core/plugin.ts�[24m �[4m/private/tmp/claude-501/-Users-isamu-ss-llm-GUIChatPlugins-GUIChatPluginSpreadsheet/33f90efa-9e7e-4395-9044-51e33d96a56b/scratchpad/plug/GUIChatPluginGo/src/core/types.ts�[24m �[33m�[1m✖ 13 problems (0 errors, 13 warnings)�[22m�[39m transforming... ✓ built in 263ms passed. Lint emitted only existing warnings.\n\nFINDINGS COMPLETE: I read every hunk of the diff and this is every finding I have. |
Summary
Closes #35.
isLegalMovereadboard[row][col]before checking the position. A negative or fractionalrowtherefore threw aTypeErrorand failed the whole tool call.src/core/position.tsaddsisOnBoard(row, col, size), which is true only when both are whole numbers inside the board.isInBoundsdelegates to it, andisLegalMovechecks it before reading the board, so these moves now get the existing invalid-move response.js/prototype-polluting-assignment(alerts 1–3). A non-numberrowsuch as"__proto__"from a JavaScript caller is now rejected before any assignment.yarn test(tsx --test tests/*.test.ts, the setup the other plugins use) withtests/position.test.ts, and runs it in CI.Items to Confirm
main. CodeQL may not treatNumber.isIntegeras a sanitizer. The crash itself is fixed either way, asyarn testshows.yarn typecheck. That matches the other plugins; adding them would need@types/node.board(wrong size or shape) is out of scope.Verification
yarn format,yarn lint,yarn build,yarn typecheckandyarn testpass.src/core/logic.tsrestored tomain, the off-board / fractional test goes red.User Prompt
🤖 Generated with Claude Code
work in GUIChatPluginSpreadsheet