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.45k stars 9.29k forks source link

Incorrect validation of html elements in content #36457

Open adamlavery opened 1 year ago

adamlavery commented 1 year ago

Preconditions and environment

oS 2.4.3-p1

Steps to reproduce

Using old style editor (not blocks editor), insert an image from the media library into the content. Wrap that image in an "a" tag. Save the content (product description, CMS page, block it doesn't matter). Something like this:

<p><a href="/uk/digital-print-design/"><strong><img style="float: left; padding: 0 20px 45px 20px;" title="useful information for digital printing" src="{{media url="wysiwyg/ALP/ICONS/design.png"}}" alt="Useful design information for our calendars" width="60" height="60" /></strong></a></p>

Expected result

Conent is saved without error

Actual result

Following warning displayed:

Temporarily allowed to save HTML value that contains restricted elements. Allowed HTML attributes for tag "a" are: class,width,height,style,alt,title,border,id,data-active-tab,data-appearance,data-autoplay,data-autoplay-speed,data-background-images,data-background-type,data-carousel-mode,data-center-padding,data-content-type,data-element,data-enable-parallax,data-fade,data-grid-size,data-infinite-loop,data-link-type,data-locations,data-overlay-color,data-parallax-speed,data-pb-style,data-same-width,data-show-arrows,data-show-button,data-show-controls,data-show-dots,data-show-overlay,data-slide-name,data-slick-index,data-role,data-product-id,data-price-box,aria-hidden,data-tab-name,data-video-fallback-src,data-video-lazy-load,data-video-loop,data-video-overlay-color,data-video-play-only-visible,data-video-src,href,role,target,tabindex,rel

Additional information

There's nothing wrong with the HTML - the error is in the validator. Appears it cannot properly validate content that contains {{media}} references. Debuggin the validator I added a little extra so the nodes the query finds can be seen:

image

Inspecting $elem shows this:

image

Somehow the wysiwyg part of the media is being detected as an invalid attibute of the a-tag, which it clearly is not. Nothing at all wrong with the a-tag itself.

This need fixing before you ever think about imposing restictions on what can be included in content. At least get the checks right first!

And while you're about about, telling us what was found as invalid is far more useful than a long list of what's allowed with nothing on what caused it.

Release note

Fix content validation so it actually works.

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @adamlavery. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

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:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

adamlavery commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @adamlavery. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @adamlavery, here is your Magento Instance: https://f393bf7da614133230dbcab35e4b85cb.instances.magento-community.engineering Admin access: https://f393bf7da614133230dbcab35e4b85cb.instances.magento-community.engineering/admin_bdd7 Login: c0acc453 Password: 9ec6cb188f7e

adamlavery commented 1 year ago

Confirmed still present.

Opened dev instance, disabled page builder, edited a product (any product), added a media image to the description (any image) and saved. No error. Modified description (any mod) and saved again and now get the false validation warning every time the description is modified and saved,

m2-assistant[bot] commented 1 year ago

Hi @engcom-Dash. 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-Dash commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash, here is your Magento Instance: https://f393bf7da614133230dbcab35e4b85cb.instances.magento-community.engineering Admin access: https://f393bf7da614133230dbcab35e4b85cb.instances.magento-community.engineering/admin_2069 Login: df189d5a Password: 208604a8eda3

engcom-Dash commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash, here is your Magento Instance: https://f393bf7da614133230dbcab35e4b85cb.instances.magento-community.engineering Admin access: https://f393bf7da614133230dbcab35e4b85cb.instances.magento-community.engineering/admin_041f Login: a38e665f Password: 8ffec965644e

engcom-Dash commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

engcom-Dash commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

engcom-Dash commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

engcom-Dash commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

engcom-Dash commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

engcom-Dash commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

engcom-Dash commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

engcom-Dash commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Dash, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

engcom-Dash commented 1 year ago

Hi @adamlavery ,

We worked this issue in 2.4-develop instance....we can able to reproduce the issue as well as we are confirming the issue.

Preconditions: Magento version: 2.4-develop instance PHP 8.1

Steps: 1.Install magento instance 2.Go to content 3.Create new Page 4.Add the given content in new page 5.Trying to save the new page 6.we got some error as per actual results. Screenshots:

Screenshot 2022-11-22 at 3 40 09 PM

So we are confirming this issue in 2.4-develop it is reproduceble.

Let us know if we missing anything!

Thanks!!!!

github-jira-sync-bot commented 1 year ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-7096 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 year ago

:white_check_mark: Confirmed by @engcom-Dash. Thank you for verifying the issue.
Issue Available: @engcom-Dash, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

adamlavery commented 1 year ago

Thanks for confirming. When fixing this can you also consider changing what's reported to attribute(s) found as invalid rather than (or in addition to) reporting a long list of what's allowed?

engcom-November commented 1 year ago

We are reopening this issue as further analysis is required. Thank you.

m2-assistant[bot] commented 1 year ago

Hi @engcom-Hotel. 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-Hotel commented 1 year ago

Hello @adamlavery,

Thanks for the report and collaboration!

We have rechecked this issue in the 2.4-develop branch and the issue is reproducible for us with the mentioned steps in the description. Hence confirming the issue.

Thanks

github-jira-sync-bot commented 1 year ago

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-7096