Valid AD0-E716 Dumps shared by ExamDiscuss.com for Helping Passing AD0-E716 Exam! ExamDiscuss.com now offer the newest AD0-E716 exam dumps, the ExamDiscuss.com AD0-E716 exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com AD0-E716 dumps with Test Engine here:
An Adobe Commerce developer has added an iframe and included a JavaScript library from an external domain to the website. After that, they found the following error in the console: Refused to frame [URL] because it violates the Content Security Policy directive. In order to fix this error, what would be the correct policy ids to add to the csp_whitelist.xml file?
Correct Answer: A
The Content Security Policy (CSP) in Adobe Commerce (Magento) restricts the types of content that can be loaded on a page to protect against malicious attacks, such as cross-site scripting (XSS). When an iframe is added, and a JavaScript library is loaded from an external source, these resources must be whitelisted explicitly using the csp_whitelist.xml file. In this specific case: * The frame-src directive controls the sources from which iframes can be embedded. Since the developer is embedding an iframe from an external domain, they need to whitelist this domain for frame-src. * The script-src directive controls the sources from which JavaScript files can be loaded. The external JavaScript library must be whitelisted under script-src to allow it to execute. Therefore, the correct policy IDs to whitelist are: * frame-src: to allow the embedding of content from an external domain in an iframe. * script-src: to allow the loading and execution of JavaScript files from the external domain. Here's how to update the csp_whitelist.xml file with the correct directives: <?xml version="1.0"?> <whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=" urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd"> <policy id="frame-src"> <values> <value id="your-external-domain.com"/> </values> </policy> <policy id="script-src"> <values> <value id="your-external-domain.com"/> </values> </policy> </whitelist> Replace your-external-domain.com with the actual domain of the external iframe and JavaScript source. Additional Resources: * Adobe Commerce Developer Guide: Content Security Policy (CSP) * CSP Policies and Directives: Explanation of all supported CSP directives and how to configure them.