Security and CSP
What the Web SDK does to stay safe on your page, which Content Security Policy rules it needs, and how allowed websites and apps work.
Web only for the page protections and CSP. Mobile apps have no origin and no CSP: they use the app entries of Allowed sources instead (see below).
Public key
The key that starts with pk_ can read published screens and send events. It cannot edit anything and is safe in your page or app. To stop other sites from using it, add your domains to Allowed sources (Pro plan and above, see Allowed sources).
- With a list set, a request whose
Originis not on it gets403 origin_not_allowed. Add every site, each subdomain, andlocalhostwhile you develop. - With no list, any website can use the key.
For apps, the iOS and Android entries of Allowed sources under API keys work the same way with the app's ID (ios:com.acme.app, android:com.acme.app) and answers 403 app_not_allowed. A request without the header passes, so it stops a key being used by the wrong app by mistake and is not a security boundary. See Errors.
What the SDK protects
- The screen draws in a shadow root. Your CSS cannot break it and its CSS cannot leak out.
- Screen text is escaped before its markdown becomes HTML.
customVariablesvalues show as plain text, never HTML. - Only
http,https,mailto,teland links starting with a single/are opened or handed toonOpenUrl. Ajavascript:ordata:link is refused and reported toonError. - Custom fonts load only from
httpsURLs. - Analytics requests use
text/plainposts with no cookies and no credentials.
Content Security Policy
If your site sets a CSP, allow:
| Directive | Value | Why |
|---|---|---|
script-src | Where you load the SDK from: your bundle, or the host of the script URL | The SDK code. |
style-src | 'unsafe-inline' | The SDK injects styles into the screen's shadow root and onto the page for overlays. |
connect-src | https://api.miniwall.app, or your apiUrl | Delivery and events. |
font-src | https://cdn.jsdelivr.net | Fonts picked in the editor load from Fontsource on jsDelivr. |
img-src | Where the screen's images live (Miniwall image storage, or your own URLs) | Images. |