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

Abierto Apto para principiantes
#17 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
html, node.js, typescript

Línea de trabajo

Lee scripts/new-game.mjs junto con games/_template/main.ts y games/_template/index.html para seguir cómo se sustituye el título y cuándo se escriben los archivos. Prueba la reproducción indicada y luego ejecuta npm run typecheck y npm run build. Se habrá terminado cuando los títulos con caracteres especiales indicados permitan crear un juego que se pueda compilar o se rechacen con un mensaje claro antes de escribir ningún archivo.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
TypeScript
Estrellas
3
Forks
3
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TMHSDigital/GH-Arcade

Todos los issues de TMHSDigital/GH-Arcade

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.