Skip to content

fix(site): raw HTML in CHANGELOG.md or ROADMAP.md would go live - #7

Merged
jamesconwaydev merged 1 commit into
mainfrom
changelog-shadow
Nov 30, 2026
Merged

jamesconwaydev merged 1 commit into
mainfrom
changelog-shadow

Conversation

@jamesconwaydev

Copy link
Copy Markdown
Contributor

Problem

netweir.com's changelog failed the header check because a release note's <template shadowrootmode> became a live element (https://github.com/netweir/website/pull/41). parsec.tools renders Parsec's CHANGELOG.md and ROADMAP.md the same way: Astro's renderMarkdown passes raw HTML through. Parsec's files keep such tags in backticks today, so the check passes on main, but one missing pair of backticks would put a live element on /changelog/ or /roadmap/.

Change

The repo-Markdown loader in apps/site/src/content.config.ts fails the build if either file renders a live <template>, <script>, <iframe>, <object> or <embed>. The error names the file and the tag.

Tests

  • The site builds, and astro check reports 0 errors.
  • The guard matches <li>a <template shadowrootmode> b</li> and not <code>&lt;template shadowrootmode&gt;</code>.
  • The full header check on main passes: 19 site pages and 41 docs pages, with consent granted and denied, with no console errors. The earlier attachShadow and 404 notes don't occur on main.

Astro's renderMarkdown passes raw HTML through, so a tag written as
text outside backticks in Parsec's CHANGELOG or ROADMAP, such as
<template shadowrootmode>, would become a live element on /changelog/
or /roadmap/. That is what broke netweir.com's changelog. Parsec's files
keep such tags in code today; the loader now fails the build if either
renders a live <template>, <script>, <iframe>, <object> or <embed>,
naming the file and the tag.

@foothillsdigital foothillsdigital left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving f5369cf. It catches the accident it's meant for, a release note's tag losing its backticks, and names the file and the tag. The regex runs on the rendered HTML, case-insensitive, so &lt;template …&gt; inside <code> passes and a bare <template shadowrootmode> stops the build.

One suggestion, not blocking: a list of banned tags covers what's been seen so far, not the class. A stray <img src=x onerror=…>, <a href="javascript:…">, <svg onload=…>, <form action=…> or <meta http-equiv="refresh"> would all render. The CSP already stops inline handlers and javascript: URLs from running, so the real exposure is small. But CHANGELOG.md and ROADMAP.md never need raw HTML, so it's simpler to not render any. Escaping raw HTML in that loader (a remark or rehype step that turns html nodes into text, or rehype-sanitize with an empty allow list for elements outside Markdown's own set) would close the whole category, and the check here could then go. Fine as a follow-up.

@jamesconwaydev
jamesconwaydev merged commit 99e25e6 into main Nov 30, 2026
1 check passed
@jamesconwaydev
jamesconwaydev deleted the changelog-shadow branch November 30, 2026 05:43
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