When to Enable Lightning Web Security

Determine whether to enable Lightning Web Security (LWS) in your production org based on the type of components present in your org. LWS is generally available for both Lightning web components (LWC) and Aura components.

New orgs have LWS enabled by default. If you create an org from a template, then that org inherits the LWS setting of the template. If you plan to populate a new org with preexisting or packaged Lightning components, be sure to test first in a sandbox environment with LWS enabled. See Workflow to Test Your Components with Lightning Web Security.

If your org contains Experience Cloud sites, see Experience Builder Sites and LWS before enabling LWS.

To determine the type of components that are present in your org, see Determine if Lightning Web Security Affects Your Org.

Components in OrgOK to Enable LWS in Production?Testing Approach
No componentsYesTesting isn’t needed because LWS has no effect if there are no components in your org. However, testing a new release is always recommended in sandboxes.
Only LWC or only AuraYes, after testing in sandboxWe strongly recommend that you first enable LWS in a sandbox staging environment for your org. See Workflow to Test Your Components with Lightning Web Security. If testing shows that your components are working well in the sandbox, enable LWS in a production org. If issues arise, you can return to using Lightning Locker for Lightning components by deselecting the LWS setting.
Aura and LWCYes, after testing in sandboxWe strongly recommend that you first enable LWS in a sandbox staging environment for your org. See Workflow to Test Your Components with Lightning Web Security. If testing shows that your components are working well in the sandbox, enable LWS in a production org. If issues arise, you can return to using Lightning Locker for Lightning components by deselecting the LWS setting.
  • If your org had the LWS setting enabled before Spring ’23 and your org contains custom Aura components, the LWS setting remains enabled and continues to affect only your Lightning web components. Your org was excluded from the LWS for Aura beta, so it didn’t affect your Aura components in Spring ’23. In Summer ’23, if your org was previously excluded from LWS for Aura, LWS remains enabled and continues to affect only Lightning web components.
  • The exclusion of some orgs from LWS for Aura applies to production orgs only. LWS for Aura is enabled in Summer ’23 sandboxes for orgs that are excluded, so that you can start testing your Aura components.

See Also