Docs
SDK

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 Origin is not on it gets 403 origin_not_allowed. Add every site, each subdomain, and localhost while 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. customVariables values show as plain text, never HTML.
  • Only http, https, mailto, tel and links starting with a single / are opened or handed to onOpenUrl. A javascript: or data: link is refused and reported to onError.
  • Custom fonts load only from https URLs.
  • Analytics requests use text/plain posts with no cookies and no credentials.

Content Security Policy

If your site sets a CSP, allow:

DirectiveValueWhy
script-srcWhere you load the SDK from: your bundle, or the host of the script URLThe SDK code.
style-src'unsafe-inline'The SDK injects styles into the screen's shadow root and onto the page for overlays.
connect-srchttps://api.miniwall.app, or your apiUrlDelivery and events.
font-srchttps://cdn.jsdelivr.netFonts picked in the editor load from Fontsource on jsDelivr.
img-srcWhere the screen's images live (Miniwall image storage, or your own URLs)Images.

On this page