Prerender hoists body tags and replaces its markers unsafely #232
Labels
No Label
P0
P1
P2
P3
accessibility
backend
bug
content
data-integrity
enhancement
frontend
infra
integration
owner
owner-input
performance
phase-7
phase-8
release-blocker
security
seo
ui
ux
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: null/Queue-North-Website#232
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Seen at
a25077d(v0.9.5).What is true now, in
scripts/prerender.js:<title>,<meta>and<link>out of the body, so an inline SVG<title>or a microdata<meta itemprop>in content becomes a second page title or a stray head tag;page.replace('</head>', str)(lines 90-91) interprets$&,$'and$$in the replacement, and React escapes&into entities, so a$directly before one injects markup. Zero$in today's copy; future pages may carry prices;dist/index.htmlis both template and output;<!--$!-->.What to do. Function replacers; assert each marker matches exactly once; refuse a template that already has a canonical; the hoist skips anything inside
<svg>or carryingitemprop; rethrow render errors with the route; fail on<!--$!-->.Verify: with a probe
<svg><title>in the footer the build still has exactly one<title>per head, a thrown render error names its route, and a Suspense-wrapped page fails the build.Fixed in
28b07ab. The hoist now parks inline in place; both marker substitutions are a split and join instead of String.replace, so a dollar sign in copy cannot inject markup, and each marker must appear exactly once; render errors are rethrown naming the route; a Suspense fallback marker fails the build; and the script refuses a template that already carries a canonical. Proven by mutation: a probe