fix(site): harden documentation rendering - #370
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
738cd4a to
72ac652
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 5:23 PM ET / 21:23 UTC. ClawSweeper reviewWhat this changesThe PR replaces HTML-based table-of-contents extraction with parser-owned heading data and escapes labels when rendering the static documentation site. Merge readiness✅ Ready for maintainer review Keep open for normal maintainer review. This member-authored draft is a focused, tested security hardening change and must not be auto-closed. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe docs-site builder reads Markdown, renders page HTML and heading metadata, then uses both to produce static documentation pages. The heading metadata now feeds the table of contents directly instead of being recovered from serialized HTML. flowchart LR
A[Markdown documents] --> B[Markdown renderer]
B --> C[Heading facts]
B --> D[Page HTML]
C --> E[TOC renderer]
E --> F[Escaped TOC links]
D --> G[Static docs site]
F --> G
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Land the parser-owned heading-data approach after normal maintainer approval, preserving the focused regression tests as the contract for safe TOC rendering. Do we have a high-confidence way to reproduce the issue? Yes: the focused renderer test runs crafted heading input through the PR’s parser and verifies the resulting TOC escapes tag fragments. Is this the best way to solve the issue? Yes: retaining structured heading facts before HTML serialization is a narrower and more maintainable boundary than sanitizing reparsed rendered HTML. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 97e14efdf91a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Summary
Root cause
The docs renderer reparsed generated heading HTML with a multi-character regex replacement. Crafted tag fragments could survive that incomplete sanitization. The renderer now records structured heading labels during inline parsing and builds the TOC from those facts instead of reparsing HTML.
Verification
node --test scripts/*.test.mjsnode scripts/build-docs-site.mjsdist/docs-siteis byte-equivalent to base97e14efdf91a7c9de1b68845321eb6355943b5f5go vet ./...go test ./...go test -tags sqlite_fts5 ./...git diff --checkCodeQL alert: https://github.com/openclaw/wacli/security/code-scanning/2