Artifacts Associated With Ticket 6ff100027fb20471c973dcc2941412d6efd42f9a
Ticket change [3d485b4a32] (rid 621) by dmestas on 2026-08-17 17:39:54:
- comment initialized to:
A repository's own documentation is currently unreadable: `/r/fossil/file/trunk/www/permutedindex.html` shows HTML source where fossil shows a rendered index. Fossil serves these through a separate `/doc/CHECKIN/FILE` route; quarry has no equivalent, so `file/` is the only view and it is a source view by design. ## How fossil does it `document_render()` (src/doc.c) dispatches on mimetype: - `text/x-fossil-wiki`, `text/x-markdown`, `text/x-pikchr` — through its converters - `text/html` — **only if** `doc_is_embedded_html()` passes, which requires the file to begin with `<div class='fossil-doc'>`. Fossil then wraps it in site chrome, lifts `data-title` as the page title, and pipes the body through `convert_href_and_output()` - anything else — the bare `else`: `cgi_set_content_type(zMime); cgi_set_content(pBody);`. Raw bytes, the file's own content type, no filtering Fossil does **not** sanitize embedded documents. Its gate is a CSP (src/style.c:631): default-src 'self' data:; script-src 'self' 'nonce-$nonce'; style-src 'self' 'unsafe-inline'; img-src * data: Inline script cannot run without the per-response nonce, which repository content cannot know. Note `script-src 'self'` still permits a committed `.js` referenced by `src`, so the model also leans on operator trust plus the `default-csp` setting. The wrapper is a real convention, not incidental: of the 10 `.html` files in fossil's tree, exactly 3 carry `class='fossil-doc'` — `www/permutedindex.html`, `www/caps/ref.html`, `www/server/index.html`. The other seven are meant to be served raw. Fossil never rewrites relative links. It does not need to: at `/doc/trunk/www/permutedindex.html` a bare `quickstart.wiki` href resolves to `/doc/trunk/www/quickstart.wiki` on its own. Only `$ROOT` and `$CURRENT` are expanded, and narrowly — inside a tag, after `href=` or `action=` only. That page uses `$ROOT` four times. ## What quarry already has `renderBody` (internal/api/register.go:1857) is already fossil's mimetype switch. `markup.Render` / `RenderFossilWiki` / `RenderPikchr` are the three converters. `file.get` already resolves symbolic versions like `trunk` through zit. A `/r/{repo}/doc/{version}/{path...}` route has the same shape as the existing file route, so relative links come free exactly as they do for fossil. ## What is missing 1. `/r/{repo}/doc/{version}/{path...}` route and a `doc.get` op 2. Embedded-HTML detection and title extraction (~40 lines; `doc_is_embedded_html` fully specifies it). The title must be read BEFORE sanitizing — the policy strips `class` and `data-title` from the wrapper div 3. `$ROOT` / `$CURRENT` expansion (~30 lines) 4. Raw passthrough for non-document types (images, CSS) so referenced assets resolve. This is where content-type and CSP decisions live, and it is a security decision rather than a rendering one ## Measured: the existing policy is nearly sufficient Running `markup.Sanitize` over `www/permutedindex.html` (8,754 bytes): - 125 of 126 links survive - all 126 list items survive - the `id` anchor survives - **lost**: the search `<form>`, and `class`/`data-title` on the wrapper div ## Decision to make Fossil's answer to hostile HTML is *no sanitizer, one CSP*. Quarry has *a sanitizer, no doc route*. Doing both is strictly stronger than fossil and costs nothing extra since the sanitizer is already written, fuzz-tested and corpus-gated — but some legitimate pages render degraded, such as losing that search form. Recommendation: ship sanitizer **and** CSP, then widen the policy from evidence. The corpus now carries fossil's, tk's and libspatialite's real doc trees to widen against, which beats widening from imagination. Estimate: about a day for the fossil-doc path (items 1–3), another day for raw passthrough (item 4). - status initialized to: "Open"
- title initialized to:
Render embedded documentation instead of showing HTML source
- comment initialized to:
Ticket change [bc3c5bfe71] (rid 859) by dmestas on 2026-08-18 18:40:06:
- Untracked field cmimetype: "text/x-markdown"
Ticket change [96a5e5f7dc] (rid 1076) by dmestas on 2026-08-19 11:04:34:
- priority changed to: "Medium"
- severity changed to: "Minor"
- type changed to: "Feature_Request"
Ticket change [db3f5f778d] (rid 1126) by dmestas on 2026-08-19 12:10:50:
- subsystem changed to: "web"
Ticket change [7accc1360c] (rid 2107) by ai-local on 2026-08-23 10:22:03:
- icomment:
Shipped. /r/{repo}/doc/{ref}/{path} renders embedded documentation in site chrome instead of showing source. Verified live: /r/fossil/doc/trunk/www/permutedindex.html returns a rendered index with working links. - mimetype: "text/x-markdown"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- icomment:
Ticket change [a5c44d4822] (rid 12444) by zeitgeist on 2026-09-24 00:52:42:
- Untracked field number: "9"