Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue 12127: Single quotation marks are now decoded properly in admin attribute option input fields #12133

Merged
merged 1 commit into from
Nov 28, 2017

Conversation

erfanimani
Copy link
Contributor

Description

Single quotation marks are now decoded properly in admin attribute option input fields.

It sort of feels like this is a workaround though. I think the right fix would be to not escape the output by PHP in the first place, and let Underscore's templating engine handle the escaping.

As it stands now, the attribute option value is first escaped in Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Options::_prepareUserDefinedAttributeOptionValues, and then it's decoded (improperly) in app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml::91, and then it's escaped again by the Underscore templating engine: <%- %>.

The problem is that the first escapes includes single quotes, but the decode doesn't (which I've added in this PR). So, I've fixed the bad decode, but why the first encode/decode is happening, I'm not sure.

Fixed Issues

Fixes issue #12127.

Manual testing scenarios

  1. As an admin, go to Stores -> Attributes -> Products -> Manufacturer
  2. Add a new attribute option called "Nature's Way Supplements"
  3. Hit "Save and continue"
  4. Hit "Save and continue" again

Result

  • Text input value now shows Nature's Way Supplements, instead of Nature&#039;s Way Supplements.
  • Database entry (eav_attribute_option_value) correctly stores Nature's Way Supplements, instead of Nature&#039;s Way Supplements.

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Nov 9, 2017

CLA assistant check
All committers have signed the CLA.

@sidolov sidolov self-assigned this Nov 22, 2017
@magento-engcom-team magento-engcom-team added Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Nov 22, 2017
@sidolov sidolov added this to the November 2017 milestone Nov 22, 2017
@szurek
Copy link

szurek commented Nov 27, 2017

Verified PR does not introduce XSS vulnerability in admin area, product view, compare products, shopping cart, and checkout.

@okorshenko okorshenko merged commit cfab448 into magento:2.2-develop Nov 28, 2017
okorshenko pushed a commit that referenced this pull request Nov 28, 2017
…coded properly in admin attribute option input fields #12133
@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Nov 28, 2017
@wclansar
Copy link

I am still getting same issue in magento 2.2.5 version .

options

@erfanimani
Copy link
Contributor Author

erfanimani commented Jul 10, 2018 via email

@wclansar
Copy link

i am at product edit page in admin and drop down attribute showing me that text instead of Apostrophe.
it should show here Pack 2's but its displaying above text .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Progress: accept Release Line: 2.2 Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants