new-game script mangles titles containing $, backticks or <

オープン 初心者向け
#17 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
html, node.js, typescript

調査の方向性

scripts/new-game.mjsをgames/_template/main.tsおよびgames/_template/index.htmlと併せて読み、タイトルがどのように置換され、いつファイルが書き込まれるかを追ってください。記載された再現手順を試し、その後npm run typecheckとnpm run buildを実行してください。記載された特殊文字を含むタイトルで、ビルド可能なゲームを生成できるか、ファイルが書き込まれる前に明確なメッセージとともに拒否されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug good first issue severity: low

Summary

The scaffolder validates the slug but substitutes the title raw into an HTML file and a TypeScript template literal.

Where

  • scripts/new-game.mjs:21, scripts/new-game.mjs:23-29
  • games/_template/main.ts:48, games/_template/index.html:7

Details

.replaceAll('__SLUG__', slug).replaceAll('__TITLE__', title)

A string replacement still interprets $$, $& and similar patterns. A title with a backtick or ${ produces a file that fails tsc; a title with < or & produces invalid HTML. The folder is copied before the registry is written, so a failure in between leaves a half-registered game. Derived from the code; not run.

Steps to reproduce

  1. npm run new-game cash "Cash $$ Grab".
  2. games/cash/index.html says "Cash $ Grab" while the registry has the correct title.

Suggested fix

Use function replacers (replaceAll('__TITLE__', () => escaped)), HTML-escape for .html, and write the title into the template as a JSON.stringify-ed constant. Or restrict titles to a safe character set.

Acceptance criteria

  • Titles with $, backticks, ${, < and & either scaffold a building game or are rejected with a clear message before any file is written

Getting started

  • Relevant files: scripts/new-game.mjs, games/_template/main.ts, games/_template/index.html
  • Run locally: npm install, then npm run dev
  • Checks: npm run typecheck and npm run build (there is no test suite yet)
  • Related docs: README.md

Filed by repo-audit/full-audit at b001f5d. Severity: low. Effort: S. audit-key: bug|scripts/new-game.mjs|replaceAll

主要言語
TypeScript
スター
3
フォーク
3
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TMHSDigital/GH-Arcade のほかの issue

TMHSDigital/GH-Arcade の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。