Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

build.mjs and thumbs.mjs trust `meta.id` for file paths, and the id regex lives in three copies

Chiusa
#135 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, node.js

Direzione di ricerca

Read site/build.mjs around lines 104 and 446, then inspect site/thumbs.mjs, site/validate.mjs, site/lib/scaffold.mjs, and site/checks.mjs for the repeated ID checks and file writes. The issue suggests a shared loader in site/lib/entry-files.mjs and pairing the change with #85. Done means one ID regex definition remains in site/, and a fixture with id: ../x makes node site/build.mjs exit 1 naming the file without touching disk.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

hardening priority: low

Why it matters

validate is the only place that enforces the id charset and id === filename. npm run build on its own, and thumbs.yml (which runs thumbs.mjs before validate), write files whose names come straight from frontmatter. CI order protects main, but a local node site/build.mjs with a bad id writes outside site/dist/.

Evidence (at 69387df)

  • site/build.mjs:446: writeOut(path.join("entry", entry.id, "index.html"), html) with entry.id = String(meta.id) (build.mjs:104). path.join("entry", "../../x", "index.html") resolves under the parent of DIST (build.mjs:292), and produced/pruneDist never see it.
  • site/thumbs.mjs:123-124, 244: ${entry.id}.src, ${entry.id}.webp in the temp dir and in site/public/thumbs/.
  • The same regex is written three times: site/validate.mjs:65, site/lib/scaffold.mjs:30 (exported ID_RE), site/checks.mjs:806 (inline).

Suggested approach

Give site/lib/entry-files.mjs one loader that reads the file, parses frontmatter, and refuses an entry whose id fails ID_RE or differs from the basename; have build, thumbs, check-links and reverify-batch use it. Export ID_RE from one module and import it everywhere. This pairs naturally with #85.

Done when

One definition of the id regex in site/; a fixture entry with id: ../x makes node site/build.mjs exit 1 naming the file, without touching the disk.

Lingua principale
JavaScript
Stelle
58
Fork
15
Merge medio
16h 53m
PR unite (30g)
14

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/Free-Game-Dev-Assets

Tutte le issue di TMHSDigital/Free-Game-Dev-Assets

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.