Newer Version Available
CspTrustedSite
Represents a CSP Trusted Site. The Lightning Component framework uses Content
Security Policy (CSP) to impose restrictions on content. The main objective is to help prevent
cross-site scripting (XSS) and other code injection attacks. To use third-party APIs that make
requests to an external (non-Salesforce) server or to use a WebSocket connection, add a CSP
Trusted Site. This object is available in API version 48.0 and later.
Supported Calls
create(), delete(), describeSObjects(), query(), retrieve(), update(), upsert()
Fields
| Field | Details |
|---|---|
| Context |
|
| Description |
|
| DeveloperName |
|
| EndpointUrl |
|
| IsActive |
|
| IsApplicableToConnectSrc |
|
| IsApplicableToFontSrc |
|
| IsApplicableToFrameSrc |
|
| IsApplicableToImgSrc |
|
| IsApplicableToMediaSrc |
|
| IsApplicableToStyleSrc |
|
| Language |
|
| MasterLabel |
|
| NamespacePrefix |
|
Usage
CSP is a W3C standard that defines rules to control the source of content that can be loaded on a page. All CSP rules work at the page level, and apply to all components and libraries. By default, the framework’s headers allow content to be loaded only from secure (HTTPS) URLs and forbid XHR requests from JavaScript.
When you define a CSP Trusted
Site, you can add the site’s URL
to the list of allowed sites for the following directives in the CSP header.
- connect-src
- frame-src
- img-src
- style-src
- font-src
- media-src