Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Geschlossen
#135 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
52/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
javascript, node.js

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
JavaScript
Sterne
58
Forks
15
Ø Merge
16 Std. 53 Min.
Gemergte PRs (30 T.)
14

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/Free-Game-Dev-Assets

Alle Issues in TMHSDigital/Free-Game-Dev-Assets

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.