Security, privacy and CSP
There is no SharedLayers server between the page and the database. Everything is authorised in the database against the visitor’s own session.
The script talks directly from the visitor's browser to a Supabase project operated by SharedLayers, using a public client key that is part of the script. Every read and write is authorised in the database by row-level security against the visitor's own session, which is why neither the embed key nor the client key is a secret.
What leaves the page
When a visitor leaves a comment, the following is stored:
- The comment text, replies, reactions and mentions.
- The author: display name and, for accounts, email. Public reads return authors without email.
- The page: its address and the page key described under pageParams. A hash is stored only when it is an app's route (
#/settings); one that points to a place on the page (#plans) never is. - The anchor: the element's CSS selector, the fractional position within it, absolute page coordinates as a fallback, and a short label of the form
<button.primary> "Add to cart". The label includes up to the first 40 characters of the element's text for headings, paragraphs, links, buttons and similar text-bearing elements. If those elements can show personal data on your pages, know that this much of it travels with the pin. - A snapshot of the viewport, unless snapshots are off.
- Any images the commenter attached, shrunk and re-encoded in the browser first.
Nothing is collected from visitors who never open the toolbar: no analytics, no fingerprint, no cookies. The SharedLayers privacy policy covers the service side.
Content Security Policy
If your site sends a Content-Security-Policy header, add the following. Origins are exact; there is no wildcard SharedLayers domain to allow.
script-src https://sharedlayers.com;
connect-src https://mtgpolxyqamundksrksi.supabase.co
wss://mtgpolxyqamundksrksi.supabase.co;
img-src https://mtgpolxyqamundksrksi.supabase.co
https://sharedlayers.com
https://*.googleusercontent.com
data: blob:;
style-src 'unsafe-inline';
Why each line:
- script-src: the script itself. If you vendor the ES build, this line is not needed.
- connect-src: the database over HTTPS for reads, writes, sign-in and snapshot and image uploads, and over a websocket for live updates. Both schemes are needed.
- img-src: snapshot images, attached images and avatars are served from the database host. Avatars for accounts and the sign-in flow can come from
sharedlayers.com, and Google avatars from Google.data:andblob:are needed while a snapshot is being rendered: the page is serialised to an SVG data URL and drawn to a canvas.blob:also shows an image in the comment box before it is sent. With snapshots off,data:can go. - style-src: the script writes its styles into
<style>elements and sets inline styles on its two containers, which a strictstyle-srcblocks. A nonce cannot be applied to a third-party script's injected styles, so'unsafe-inline'for styles is the practical setting. This is a policy on your review environment; production, if it does not carry the script, does not need it.
Google sign-in opens a popup window on sharedlayers.com. Popups are not governed by CSP, but a browser popup blocker will stop it unless it is opened from a click, which it is.
Browser storage
The script writes to localStorage and sessionStorage on your site's origin. It sets no cookies.
| Key | Holds |
|---|---|
comments-widget-auth | The visitor's SharedLayers session, guest or account. |
sl-theme-widget | The light or dark choice made in the account menu. |
sl-layer:<site id> | The layer last chosen on this site. |
sl-key:<key>@<host> | The site this key stood for on this host, kept for an hour so that a repeat visit draws the bar before the key check answers. |
sl-toolbar-collapsed | Whether the visitor folded the button layout away (1) or opened it (0). Only the button and floating layouts write it. |
sl-upgrade-pending | Set briefly while a guest is turning into an account. |
sl-filters:<user id>:<host> | The side panel's filters this person chose on this site, so they are the same on the next visit. Only while signed in. |
In sessionStorage, which is this tab's only and goes when it closes:
| Key | Holds |
|---|---|
cw-draft:<…> | A comment or reply being written, so closing the box by accident or a page change does not lose it. Gone once it is sent or cancelled. |
cw-reopen-panel, cw-pending-focus | Kept for one page change while a comment on another page is opened from the side panel: the panel stays open and the comment is shown when the page arrives. |
On an app on your own computer, comments are kept in its project folder, and the browser remembers which folder in an IndexedDB database called sharedlayers-local. See Apps on your computer.
Clearing site data for your origin signs the visitor out of SharedLayers on that site and forgets their theme, layer, filters and whether the button was open. It does not delete anything they wrote.