Skip to main content

Content Security Policy (CSP)


A Content Security Policy (CSP) is a security feature that helps protect web applications from various attacks like Cross-Site Scripting (XSS), clickjacking, and data injection. By specifying allowed content sources, CSPs minimize the risk of executing malicious content on your site.

CSP Guidance


The following is a partial CSP that covers WalletConnect's libraries and services for AppKit. Note that you may need to define additional sources based on your application's requirements.

default-src 'self';
script-src 'self';
img-src 'self' data: blob:;
font-src 'self';
connect-src 'self' wss:// wss:// wss://;
frame-src 'self';

You may need to list the RPC endpoints used by blockchain networks you have enabled (e.g. via the @wagmi/chains package) as part of your connect-src definition.

For a full of list of RPC sources used by wagmi/viem, please refer to Viem's chain definitions.

Testing and Deploying Your CSP

Test Your CSP in a Staging Environment

Run through your standard user flows in a staging environment with CSP enforcement. This may include connecting to browser extension wallets, transacting, logging out, etc. Directives may need updates after SDK upgrades. Always test your CSP again before deploying updates to production.

Using Report-Only Mode

Use the Content-Security-Policy-Report-Only header, which sends violation reports without enforcing policies. This helps assess the impact of CSP changes without affecting functionality.


First deploy your CSP in report-only mode. After validation, migrate to Content-Security-Policy for enforcement.


Configure report-uri or report-to to receive violation reports and set up a monitoring dashboard for review.