Show answerHide answer
Correct answer: A The endpoint URL has been added to Content Security Policies
Explanation
Explanation:Why A is correct:
Lightning Web Components (LWCs) execute client-side code directly inside the user's browser. By default, Salesforce enforces a strict Content Security Policy (CSP) to help prevent cross-site scripting (XSS) and code injection attacks. This policy blocks outbound client-side HTTP or Fetch requests and WebSocket connections to third-party endpoints unless the target domain is explicitly registered under CSP Trusted Sites, also known as Trusted URLs, in Salesforce Setup with the appropriate directives enabled, such as connect-src.
Why B is incorrect:
Cross-Origin Resource Sharing (CORS) is a browser-level security mechanism enforced by the external server receiving the request. It determines whether that server allows responses to be read by a different origin, such as Salesforce. While CORS configuration issues can cause callouts to fail, configuring CORS within Salesforce whitelist settings is used for incoming requests to Salesforce APIs from external applications, not for outbound requests originating from an LWC.
Why C is incorrect:
Remote Site Settings are required for server-side callouts originating from Apex, such as requests made using the Http class. They do not govern client-side JavaScript or Lightning Web Component execution.
Reference/;
Salesforce Pattern: Client-Side Integration Security / Lightning Security Architecture
Salesforce Documentation: Call APIs from JavaScript (LWC Developer Guide)