Newer Version Available
Content Security Policy in Lightning Communities
Experience Builder provides different levels of script security for Lightning communities. CSP levels are specific to each community. See “Select a Security Level in Lightning Communities” in Salesforce Help.
| Security Level | Description |
|---|---|
| Strict CSP: Block Inline Scripts and Script Access to All Third-party Hosts | Default setting for communities created in Spring ’19 (February 2019) and
later. Provides maximum security.
|
| Relaxed CSP: Permit Access to Inline Scripts and Allowed Hosts | Provides moderate security.
|
| Allow Inline Scripts and Script Access to Any Third-party Host | Provides no added security, but enables your community to work as currently
designed.
|
Strict CSP mitigates the risk of cross-site scripting (XSS) and other content injection attacks by disallowing the unsafe-inline keyword for inline scripts. Consider updating your third-party libraries to modern versions that don’t depend on unsafe-inline. For more information see “eval() Function is Limited by Lightning Locker” in the Lightning Aura Components Developer Guide.
In addition to affecting custom Lightning components, strict CSP also affects the markup used in the <head> of your community’s pages, when enabled. Inline scripts aren’t permitted, and a warning appears when you enter unsupported markup tags in in Experience Builder.