Newer Version Available
Develop Secure Sites: Lightning Locker and CSP
Experience Builder sites use Content Security Policy (CSP) and Lightning Locker to
secure your site from malicious attacks and custom code vulnerabilities. Factor in the potential
impact of these security features when you develop your own custom components, use third-party
components, or add custom code in the head
markup.
CSP
CSP is a W3C standard for controlling the source of content that can be loaded on a page. CSP rules work at the page level and apply to all third-party components and custom code. By default, the framework’s headers allow content to be loaded only from secure (HTTPS) URLs and forbid XHR requests from JavaScript.
Different levels of CSP script security are available from Experience Builder. CSP levels are specific to each site.
Lightning Locker
Lightning Locker is a powerful Salesforce security architecture that allows third-party
components and custom code to run safely on the same page in the browser. Security is
enhanced by:
- Isolating code in their own namespace
- Permitting access only to supported APIs
- Eliminating access to non-published framework internals
Lightning Locker is enabled by default for all new Experience Builder sites. If a third-party component or custom code doesn’t work as expected due to Lightning Locker, see Resolve Lightning Locker Conflicts in Experience Builder.