Skip to content

Conversation

@michaelbarnes
Copy link
Contributor

@michaelbarnes michaelbarnes commented Jan 28, 2026

Summary

Adds comprehensive Content Security Policy (CSP) documentation for the PowerSync Web SDK, specifically covering the wasm-unsafe-eval requirement.

Changes

  • Added new "Production Deployment Requirements" section to client-sdks/reference/javascript-web.mdx
  • Documents the required wasm-unsafe-eval CSP directive
  • Explains why it's required (wa-sqlite runtime WASM compilation)
  • Clarifies security implications and comparison to unsafe-eval
  • Includes browser compatibility information (Safari 15.2+, Chrome 95+, Firefox 102+)
  • Links to official SQLite WASM and WebAssembly CSP specification docs

Context

This addresses a common production deployment issue where PowerSync fails in Safari when the wasm-unsafe-eval CSP directive is missing. Security teams often flag this directive due to XSS concerns, but it's actually more secure than unsafe-eval as it only permits WebAssembly compilation, not JavaScript eval.

Placement

Positioned this in the Developer Notes section of the Web SDK docs.

Related

  • Customer support inquiry: 2026-01-28_email-0001
  • wa-sqlite peer dependency requirement
  • Safari CSP strict enforcement behavior

🤖 Generated with Craft Agent

michaelbarnes and others added 3 commits January 28, 2026 11:32
Add CSP documentation explaining the wasm-unsafe-eval requirement for
PowerSync Web SDK. This addresses a common production deployment issue
where PowerSync fails in Safari due to missing CSP directives.

Key additions:
- Explanation of why wasm-unsafe-eval is required
- Security considerations and comparison to unsafe-eval
- Browser compatibility information
- Links to official WASM CSP documentation

Resolves customer support inquiry about CSP requirements.

Co-Authored-By: Craft Agent <agents-noreply@craft.do>
Relocate Content Security Policy documentation from early in the document
to the Developer Notes section for better organization.

Co-Authored-By: Craft Agent <agents-noreply@craft.do>
@michaelbarnes
Copy link
Contributor Author

In addition to this change I've also put together a test which verifies this:
https://github.com/powersync-community/csp-test

Copy link
Contributor

@rkistner rkistner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not clear here - does it also work if you just have no CSP at all?

@stevensJourney
Copy link
Contributor

I believe it should just work if you have no CSP specified. I could verify this by testing a PowerSync web app hosted on Github pages (which does not send a Content Security Header response)

From looking at the attached demo script. It seems like a CSP is defined for both cases. So I assume a CSP is required to trigger this.

I imagine having a CSP is quite common, but, I agree - we should make a note about this in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants