Skip to content

fix(annotate): strip document-authored CSP meta tags that block the annotation bridge - #1259

Merged
backnotprop merged 1 commit into
mainfrom
fix/annotate-csp-meta
Aug 10, 2026
Merged

fix(annotate): strip document-authored CSP meta tags that block the annotation bridge#1259
backnotprop merged 1 commit into
mainfrom
fix/annotate-csp-meta

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

TLDR: A document that ships its own CSP meta tag (including Plannotator's own portable guided-review HTML exports, which embed default-src 'none') blocked the injected inline annotation bridge, so annotating such a file did nothing at all: no pinpoint, no selection. injectIntoHead now strips document-authored CSP meta tags before splicing the bridge. Pre-existing bug, found in v0.26.8 manual QA when annotating one of our own exports.

Label: AI-assisted.

The iframe sandbox attribute is the annotate surface's actual security boundary; the page's CSP was authored for its standalone context, so removing it inside the viewer does not weaken anything. The removal is tolerant of attribute order, quoting, casing, and self-closing forms; other http-equiv metas and the rest of the head are untouched. A replacement comment marks the removal in the assembled srcdoc.

Validation: new regression test covering the exact exported tag plus variants, mutation-verified (neutralization disabled makes it fail); srcdoc suite 74 pass; typecheck clean.

…ge can run

A document carrying its own <meta http-equiv=Content-Security-Policy> (including
Plannotator's own portable guided-review exports, which embed default-src 'none')
blocked the injected inline bridge script, disabling annotation entirely for that
file. The iframe sandbox attribute is the annotate surface's security boundary;
the page's CSP was authored for its standalone context, so injectIntoHead now
strips CSP meta tags (order/quote/case tolerant) before splicing the bridge.

Pre-existing bug, surfaced during v0.26.8 manual QA. Mutation-verified test.
@backnotprop
backnotprop merged commit c4fc79f into main Aug 10, 2026
16 checks passed
@backnotprop
backnotprop deleted the fix/annotate-csp-meta branch August 10, 2026 23:00
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