Microsoft is introducing Content Security Policy (CSP) enforcement in SharePoint Online to strengthen security against threats like cross-site scripting (XSS) and code injection. This change affects how scripts and custom solutions run in your SharePoint environment.
More details can be found here in this Microsoft blog
All inline non-compliant scripts will be blocked and must be re-written. Where external URLs are referenced within scripts, these must be added into the SharePoint central administration Trusted Sources.
Below is an example of an inline script. It is not CSP compliant and will be blocked from March 1st, 2026:
<script type="text/javascript">alert('inline script');</script>
Below is an example of a script referenced to a local source, as it references a JavaScript file located on the same server, it is CSP compliant and does not have to be included as a Trusted Script Source:
<script type="text/javascript" src="/SiteAssets/my-script-file.js"></script>
Below is an example of a script referencing an external source, in this case the URL or the domain must be defined as a Trusted Script Source in SharePoint in order to be CSP compliant:
<script type="text/javascript" src="https://www.externaldomain.com/example-js/my-script-file.js"></script>
You can already estimate the impact this policy will have on your environment. The following steps will help you identify the SharePoint pages that are not CSP compliant and the scripts that will be blocked from March 1st, 2026:
To be CSP compliant please follow theses instructions:
From the list of inline scripts obtained from the Audit described previously:
The scripts identified in the Audit will have to be manually added to the SharePoint Trusted Script Sources:
If you need more time, you can delay CSP enforcement for your tenant by 90 days (until June 1, 2026) using the SharePoint Online Management Shell:
Set-SPOTenant -DelayContentSecurityPolicyEnforcement $true
End users may notice broken functionality or warning messages when CSP enforcement begins. We recommend:
If you are a customer, check our Zendesk knowledge base for the more in-depth technical article.