Repository navigation
Harden Leaf's document delivery policy - #326
Conversation
# Conflicts: # tests/test_render_controls.py # tests/test_render_export.py
leaf-agent
left a comment
There was a problem hiding this comment.
One gap in the framing half of the policy: the product site's own delivery path never adds the header, so the claim the new reference section makes isn't true of leaf.page itself. Detail inline.
The rest reads clean. supervised_document already rebuilt the meta from PAGE_CSP, so historical revisions inheriting today's directives is a docstring correction rather than a behaviour change, and the round-trip test that rewrites r2 back to the old policy (renaming the file so the content digest still matches) proves it at the route. base-uri/form-action reach nothing the layer uses — no <base> anywhere in the runtime or corpus, and the only <form> is the MCP App's own document, which is outside PAGE_CSP. The docs/session.js thread anchor now matches what served_state/conversation.py puts on the wire, which is what living-margin.js reads.
Main added lf-drawing and lf-conversation to the document-level class allowlist in #326, with a comment covering both. Merging this branch left a second copy of each, which ruff's duplicate-member check fails on. Keep main's block and drop this branch's now-redundant entries.
Leaf's CSP constrained fetches but still allowed a document or same-origin package to replace the base URL, submit a form to another origin, or place an ordinary live page in an outside frame. This change adds
base-uri 'none'andform-action 'none'to the canonical document policy, and ordinary HTML responses now addframe-ancestors 'none'at the delivery boundary. Historical pages receive the current policy when served. The product site's Worker applies the same framing policy to static HTML assets, while the process-scoped MCP page server omits it because the approved MCP App host is its intended parent.The authored scaffold, examples, generated corpus, and validation reference now share that policy. Server and browser coverage exercises current and historical routes, standalone exports, website examples, and the MCP transport.
The full local nightly run also exposed stale gate coverage: the static product-site projection had dropped thread anchors, the media focus ring was unreachable from the corpus, and several coverage checks had drifted from the runtime. Those are aligned here. After merging current
main, the focus-ring sweep caught the new gloss ring crossing a table edge; its two-pixel band now draws inside the gloss box.Checks:
uv run pytest tests— 888 passedpre-commit run --all-files