Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 24, 2026

The validateGameId function was missing whitespace validation, allowing game IDs with spaces, tabs, or newlines to pass validation. This could lead to URL construction issues and potential injection vectors.

Changes:

  • Added regex check !/\s/.test(gameId) to reject any whitespace characters in game identifiers
function validateGameId(gameId: string): boolean {
  return (
    gameId.length > 0 &&
    !gameId.includes("/") &&
    !gameId.includes("?") &&
    !gameId.includes("#") &&
    !gameId.includes("..") &&
    !/\s/.test(gameId)  // Reject whitespace (spaces, tabs, newlines, etc.)
  );
}

Archive.org identifiers should not contain whitespace; this validation ensures malformed IDs are rejected before URL construction.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: idosal <18148989+idosal@users.noreply.github.com>
Copilot AI changed the title [WIP] Update implementation for arcade server based on feedback Add whitespace validation to arcade server game ID validation Jan 24, 2026
Copilot AI requested a review from idosal January 24, 2026 23:06
@idosal idosal marked this pull request as ready for review January 24, 2026 23:39
Copilot AI review requested due to automatic review settings January 24, 2026 23:39
@idosal idosal merged commit 6982499 into exxamples/arcade Jan 24, 2026
4 of 5 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the security of the arcade server by adding whitespace validation to game identifier validation. The change prevents malformed archive.org identifiers containing spaces, tabs, or newlines from being processed, which could lead to URL construction issues.

Changes:

  • Added regex check !/\s/.test(gameId) to reject whitespace characters in the validateGameId function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants