Repository navigation
Description
Summary
docs/embedding.md tells hosts in three places that omitting style-src 'unsafe-inline' renders
the widget "completely unstyled". That consequence was measured before #236 moved the stylesheet
into the shadow root, and the mechanism it rests on no longer exists.
The widget's stylesheet is now a constructed CSSStyleSheet (src/styles/sheet.ts:74-85:
new CSSStyleSheet(), replaceSync(chunk.css), assigned to adoptedStyleSheets). CSP's
style-src has no hook on replaceSync, so that sheet is not gated by the policy at all. The
only inline <style> the widget still appends to the host document is sahaj-atlas-fonts
(src/styles/fonts.ts:131, document.head.appendChild).
So the stated cause and the stated consequence have come apart, and a host reading the CSP table
cannot tell what they are actually trading away.
Found incidentally while fixing the troubleshooting row in #261.
Approach
The three passages that assert it, all of which move together or not at all:
docs/embedding.md:813— the CSP table'sstyle-srcrow: "The hard ask. The widget has no
stylesheet to link — it appends<style>elements at runtime, which carry no nonce." →
consequence "the widget renders completely unstyled, and does not degrade". The premise is
now false for everything except the font faces.docs/embedding.md:849— the consequence summary table: "style-src 'unsafe-inline'→ renders
completely unstyled".docs/embedding.md:1169— the troubleshooting row: "The widget renders completely unstyled |
style-src 'unsafe-inline'is missing from your CSP."
⚠ Do not rewrite these from the source read above. Two things make the real answer
non-obvious, and both need a browser:
- Style attributes are still gated.
'unsafe-inline'instyle-srcalso licensesstyle
attributes, and this widget sets a lot of them — every Reactstyle={}prop, vaul's drawer
transforms and snap offsets, Radix's positioning, thearia-liveregion's inline clipping
styles (docs/embedding.md:973-976), and mapbox-gl's own marker and canvas positioning. A
policy without'unsafe-inline'therefore breaks far more than the typeface, even while the
adopted sheet keeps applying. Whether the result reads as "unstyled", "laid out wrong", or
"mostly fine" is an observation, not a deduction. - Constructed-stylesheet gating is a moving target. Whether
replaceSyncis subject to
style-srchas been argued both ways in the CSP spec. Confirm against the browsers in
docs/embedding.md's support floor rather than against this ticket.
So: reproduce it, then write what you saw.
pnpm review:embed serves dist/ as real host-page embeds, which is the right harness — it needs
a response header, so add the policy there or front it with a proxy that sets one. Also check
whether style-src-attr and style-src-elem split the two halves cleanly enough to be worth
naming in the table, since a host who only needs the font faces could then keep a tighter policy.
Update font-src's row too if the font faces turn out to be the part style-src governs — the
two rows currently describe the typeface's failure independently (:814, "text falls back to your
system sans, everything works").
Acceptance criteria
- Each of the three passages states a consequence that was observed in a browser against a
policy without'unsafe-inline', at the support floor the guide already names. - The
style-srcrow's rationale describes how the widget actually installs styles — a
constructed sheet plus one<style>for the font faces plus style attributes — not a
stylesheet it "appends at runtime". - The three passages agree with each other, and with the
font-srcrow, about what a host
loses. -
CHANGELOG.mdgets an entry only if the recommended policy changes. A corrected description
of an unchanged policy is guide accuracy, not something a host can observe.
Verification checklist
- Reproduce with
pnpm build && pnpm review:embed, serving aContent-Security-Policyheader
that omits'unsafe-inline'fromstyle-src, and screenshot the result. - Repeat with
style-src-elemandstyle-src-attrset separately, and record which half each
one costs. - Confirm from the network panel and the console which blocked-directive reports the browser
emits, so the troubleshooting row can tell a host what to look for. -
grep -n "unsafe-inline" docs/embedding.md— every hit agrees with what was measured. -
pnpm lint && pnpm typecheck && pnpm test:runpass.
Notes
No automated lane can hold this. The smoke lane reads deployed file content over fetch, so
it cannot observe a CSP decision made by a rendering engine — docs/testing.md states the same
limit for the widget rendering at all. The guard here is that the claim was observed once and
dated, not that a spec pins it.
Related, same root cause: #261 fixed the troubleshooting row that still
denied the shadow root, and the style-src rows are the same class of claim left behind by #236.
#262 is a code defect found in the same sweep.
🤖 Written by the sydevs autonomous loop — see what this is
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
Ardnived commentedon Oct 10, 2026
@sydevs-bot implement
sydevs-bot commentedon Oct 10, 2026
🤖 no session running
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.
fix(docs): count the six notes on the CSP table