In Summer ’26, Salesforce excludes malformed URLs from generated Content Security Policy (CSP) HTTP headers. Starting with Spring ’25, admins can’t save a malformed URL as a trusted URL. If an org has malformed URLs in its list, an admin added them before February 2025. To keep your Trusted URLs list accurate, remove any malformed entries.
In Salesforce Classic, click Your Name, and then click Developer Console.
In Lightning Experience, click the quick access menu (the gear symbol), and then click Developer Console.
Go to Debug > Open Execute Anonymous Window.
Paste the Apex code into the execution window.
// Define a regex pattern that will match valid domain definitions.
Pattern validUrl = Pattern.compile(
'[A-Za-z0-9\'' + Pattern.quote('-._~:@!$&()*+,;%=/?#[]') + ']+');
// Fetch all CspTrustedSite for this org.
List<CspTrustedSite> cspTrustedSites = [
SELECT ID, EndpointUrl
FROM CspTrustedSite
];
// Loop over all CspTrustedSites and test if the URL is correct.
for(CspTrustedSite entry : cspTrustedSites) {
Matcher m = validUrl.matcher(entry.EndpointUrl);
// When the URL is not valid, print a debug message.
if(!m.matches()) {
System.debug(logginglevel.INFO, 'URL: ' + entry.EndpointUrl);
}
}
Select Open Log so the results appear automatically after execution.
Click Execute.
After the execution log opens, select the Debug Only filter box. This filters the list to show only the malformed URLs.
Review the list of malformed URLs shown in the filtered log.
To export a full list of results, download the log file.
Click File > Download Log.
Open the downloaded file in a text editor.
Search for the USER_DEBUG prefix to find the identified malformed URLs in the full log.
Salesforce Help: Open the Developer Console
Salesforce Help: Manage Trusted URLs
005317938

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.