Content Security Policy - iProov/web GitHub Wiki
Target SDK Version: 6.1.0+
Starting with version 6.1.0, the SDK fully eliminates the need for unsafe-eval. All modern browsers now support wasm-unsafe-eval, which allows WebAssembly compilation while still blocking JavaScript eval.
The wasm-unsafe-eval directive is supported in:
- Chrome 97+ (Jan 2022)
- Firefox 102+ (Jun 2022)
- Safari 16+ (Sep 2022)
- Edge 97+ (Jan 2022)
| Browser | Version(s) |
wasm-unsafe-eval Support |
Notes |
|---|---|---|---|
| Chrome (Android) | 142 | β Yes | |
| Firefox (Android) | 144 | β Yes | |
| QQ Browser | 14.9 | Chromium-based, verify or use fallback | |
| UC Browser | 15.5 | Chromium-based, verify or use fallback | |
| Android Browser | 142 | β Yes | |
| Chrome | 109-142 | β Yes | All versions 97+ supported |
| Edge | 140-142 | β Yes | |
| Firefox | 140-145 | β Yes | |
| iOS Safari | 16+ | β Yes | Supports wasm-unsafe-eval
|
| iOS Safari | 15.2-15.8 | β No | Not supported from Web SDK 7.0.0 β the support checker rejects these devices |
| Safari (macOS) | 15.2-15.6 | β No | Requires unsafe-eval fallback |
| Opera Mobile | 80 | β Yes | Chromium-based |
| Opera | 121-122 | β Yes | Chromium-based |
| Safari | 16+ | β Yes | |
| Samsung Internet | 28-29 | β Yes | Chromium-based |
Note: iOS Safari versions are tied to iOS/iPadOS versions. All browsers on iOS (Chrome, Firefox, Edge, etc.) use WebKit and follow Safari's CSP support.
In order for us to support our customers deploying CSP, we advise the below configurations as a starting point.
- If you set custom
base_urlorassets_urlsettings, then*.secure.iproov.meandcdn.iproov.appwill need to be interchanged respectively. - If you serve Web SDK assets from the same origin, then workers shall be instantiated directly. Otherwise the cross-origin Worker pattern is used, which requires
blob:inworker-srcandchild-srcas appropriate. - Combine the
CSP_NONCE_ATTRIBUTEwith thecsp_nonceoption available starting in3.1.0-beta.3. - If you do not wish to use a nonce, then it can be substituted with
unsafe-inlineinstead.
default-src 'self';
font-src 'self';
script-src 'self' blob: cdn.iproov.app 'wasm-unsafe-eval';
style-src 'self' cdn.iproov.app 'nonce-CSP_NONCE_ATTRIBUTE';
worker-src blob: cdn.iproov.app;
child-src blob: cdn.iproov.app;
connect-src 'self' *.secure.iproov.me wss://*.secure.iproov.me cdn.iproov.app;
object-src 'none';
base-uri 'none';
frame-ancestors 'none';
form-action 'self';
report-uri https://csp.example.com/report;
Safari 15 on macOS does not support wasm-unsafe-eval. If you need to support it, you must use unsafe-eval as a fallback:
βΉοΈ This applies to macOS Safari 15.2 to 15.6 only. From Web SDK 7.0.0 the iOS and iPadOS floor is 16, so no iOS device the SDK still runs on needs this fallback.
default-src 'self';
font-src 'self';
script-src 'self' blob: cdn.iproov.app 'wasm-unsafe-eval' 'unsafe-eval';
style-src 'self' cdn.iproov.app 'nonce-CSP_NONCE_ATTRIBUTE';
worker-src blob: cdn.iproov.app;
child-src blob: cdn.iproov.app;
connect-src 'self' *.secure.iproov.me wss://*.secure.iproov.me cdn.iproov.app;
object-src 'none';
base-uri 'none';
frame-ancestors 'none';
form-action 'self';
report-uri https://csp.example.com/report;
Replace csp.example.com with a reporting service such as https://report-uri.com/ or https://sentry.io/.
Important: When both wasm-unsafe-eval and unsafe-eval are specified, modern browsers (Safari 16+, Chrome 97+, Firefox 102+, Edge 97+) will use only wasm-unsafe-eval for WebAssembly compilation while still blocking JavaScript eval(). macOS Safari 15 will fall back to unsafe-eval to allow WebAssembly compilation.
Security Note: Including
unsafe-evalweakens your CSP by allowingeval()and related functions in browsers that don't supportwasm-unsafe-eval. It is no longer relevant to iOS or iPadOS β Web SDK 7.0.0 rejects anything below 16 β so consider whether macOS Safari 15 support is required for your user base before weakening the policy for it.
Note that:
- This advice is relevant to Web SDK 6.1.0+.
- There is no one-size-fits-all CSP template.
- These requirements will change according to how the Web SDK is integrated into your web app.
We deliver a small payload of inline CSS to ensure <iproov-me> won't cause a FOUC before, during or after it loads into the DOM. It is more convenient for all if the component self-manages its critical render path; in this way, no configuration is needed from the integration team.
iProov's ultimate goal is to ensure that our SDK requires minimal content security modification beyond allowlisting the base (streaming) and asset URLs.
We strongly recommend that you configure your web app to prevent it from being framed by other sites, except for your own domain (e.g. www.example.com). This helps protect your users from clickjacking and other security risks while using our Web SDK.
You can achieve this by setting the following HTTP response headers on any page that incorporates our SDK:
Content-Security-Policy: frame-ancestors 'self' https://www.example.com;
Please make sure that the domain at the end is the domain you are using for our Web SDK integration. If you don't need to allow framing from any external domain, you can simply use:
Content-Security-Policy: frame-ancestors 'self';
Or to completely prevent any framing (as shown in our recommended configurations above):
Content-Security-Policy: frame-ancestors 'none';
For more information, see the MDN documentation on frame-ancestors.
For legacy browser support, you should also set the X-Frame-Options header:
X-Frame-Options: SAMEORIGIN
This header ensures that only your own domain can frame your web app, while all other sites (e.g. attacker phishing sites) are blocked from doing so.
If you want to prevent all framing (equivalent to frame-ancestors 'none'), use:
X-Frame-Options: DENY
Note: X-Frame-Options is superseded by frame-ancestors but is still recommended for browsers that don't fully support CSP Level 2. Unlike frame-ancestors, X-Frame-Options cannot allowlist multiple specific external domainsβif you need multi-origin framing support, rely on CSP frame-ancestors instead.
When integrating the Web SDK, we recommend implementing server-side origin validation as an additional security measure. This is particularly relevant for WebSocket connections.
Without origin validation, a malicious website could attempt to establish WebSocket connections to your server on behalf of a user, potentially as part of a cross-site WebSocket hijacking or phishing attack. Validating the Origin header on your server helps prevent such attacks by ensuring requests only originate from your authorised domains.
On your server, maintain an allowlist of permitted origins for your integration:
https://example.com
https://example.edu
https://example.org
Note that origins include the scheme (e.g. https://), so ensure your allowlist matches the full origin format.
When handling connections or requests, validate the Origin header against this allowlist and reject any connections that don't match.
For more information about the Origin header, see the MDN documentation on Origin.
Note: Origin checking must be implemented on the server-side of your integration. The Web SDK connects to iProov endpoints (e.g. wss://*.rp.secure.iproov.me/), and while iProov validates origins on our infrastructure, you should also implement origin validation on your own servers that interact with the SDK.