magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

Set Custom Price In Admin Blocked By CSP #38745

Closed jorgb90 closed 5 months ago

jorgb90 commented 5 months ago

Preconditions and environment

Steps to reproduce

Expected result

Being able to set a Custom Price.

Actual result

Not working, because its blocked by CSP.

Refused to execute inline event handler because it violates the following Content Security Policy directive: "directive". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.

Additional information

<script nonce="c29oNmVsdjczMGJncmU2Nmd2czZ6a3ZqYTYwcmdpdmE&#x3D;">
var deps = [];
deps.push('Magento_Sales/order/create/form')
deps.push('mage/adminhtml/grid');
require(deps, function() {

    //<![CDATA[

    sales_order_create_search_gridJsObject = new varienGrid("sales_order_create_search_grid",'https\u003A\u002F\u002Fwww.url.com\u002Fadmin\u002Fsales\u002Forder_create\u002FloadBlock\u002Fblock\u002Fsearch_grid\u002Fkey\u002Fb6656c180e813b5118400b19cbf002ff449335de3a18958a2ab1751fd4646b0e\u002F','page','sort','dir','filter');

    sales_order_create_search_gridJsObject.useAjax = '1';

    sales_order_create_search_gridJsObject.rowClickCallback = order.productGridRowClick.bind(order);
    sales_order_create_search_gridJsObject.checkboxCheckCallback = order.productGridCheckboxCheck.bind(order);
    sales_order_create_search_gridJsObject.filterKeyPressCallback = order.productGridFilterKeyPress;
    sales_order_create_search_gridJsObject.initRowCallback = order.productGridRowInit.bind(order);
    sales_order_create_search_gridJsObject.initGridRows();

    //]]>

});
</script>

Release note

No response

Triage and priority

m2-assistant[bot] commented 5 months ago

Hi @jorgb90. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 5 months ago

Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Delta commented 5 months ago

Hi @jorgb90 ,

Thanks for reporting and collaboration.

Verified the issue in magento on latest 2.4.7 and 2.4-develop instance and the issue is not reproducible.

Steps to reproduce:-

1.Go to admin 2.Create order 3.Pick customer 4.Pick item 5.Try to alter the price through Custom Price checkbox

Please find attached the video and let us know if we missed something.

https://github.com/magento/magento2/assets/51681379/64758658-946d-42a6-85e1-a1406b405206

jorgb90 commented 5 months ago

@engcom-Delta Thanks for checking this issue. For us the box won't even appear when clicking on Custom Price. In the console it then outputs that CSP is blocking it. I am going to look into it again.

jorgb90 commented 5 months ago

@engcom-Delta It seemed that a module was overwriting the grid.phtml so we needed to update it to be compatible again. Unfortunately didn't found this before opening the issue.