umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
Other
4.49k stars 2.69k forks source link

Having "parentNode" as alias #8837

Closed Lantzify closed 2 years ago

Lantzify commented 4 years ago

Having "parentNode" as alias causes the broswer to hang.

Umbraco version

I have tested this issue on Umbraco version: 8.2.0 & 8.6.4

Bug summary

When trying to give a property an alias of "parentNode". Umbraco spits out range error. And if the doucment type already has a property with alias of "parentNode" the document type become unbrowseable and just hangs.

Specifics

This dosen't occur in version 8.0.1 I have tested this on 2 different Umbraco installation. One with version 8.6.4 and one with 8.2.0. I have tested this in the latest version of Firefox & Chrome.

umbraco.directives.js?cdv=1949971744:16131 Uncaught RangeError: Maximum call stack size exceeded
    at Function.[Symbol.hasInstance] (<anonymous>)
    at UntouchabilityChecker.hasDisplayNone (umbraco.services.js?cdv=1949971744:8119)
    at UntouchabilityChecker.hasDisplayNone (umbraco.services.js?cdv=1949971744:8129)
    at UntouchabilityChecker.hasDisplayNone (umbraco.services.js?cdv=1949971744:8129)
    at UntouchabilityChecker.hasDisplayNone (umbraco.services.js?cdv=1949971744:8129)
    at UntouchabilityChecker.hasDisplayNone (umbraco.services.js?cdv=1949971744:8129)
    at UntouchabilityChecker.hasDisplayNone (umbraco.services.js?cdv=1949971744:8129)
    at UntouchabilityChecker.hasDisplayNone (umbraco.services.js?cdv=1949971744:8129)
    at UntouchabilityChecker.hasDisplayNone (umbraco.services.js?cdv=1949971744:8129)
    at UntouchabilityChecker.hasDisplayNone (umbraco.services.js?cdv=1949971744:8129)

Chrome gives error code: Out of Memory

Steps to reproduce

On any document type add property and make the alias "parentNode". Select Textstring or Content picker as a editor and press submit.

nul800sebastiaan commented 4 years ago

Yes, that's a known limitation since parentNode is something that already exists in our querying etc. We should prevent you from using that alias though. I am sure we already do that with aliases like content for example, so we should add parentNode to the list of things you can't use as an alias for a property.

umbrabot commented 4 years ago

Hi @Lantzify,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post

Thanks muchly, from your friendly Umbraco GitHub bot :-)

mjbarlow commented 4 years ago

Took a look at this, as far as I can tell it's an issue with a recursive call going into an infinite loop. UntouchabilityChecker.prototype.hasDisplayNone

on line 9597 in umbraco.services.js

else if (node.parentNode)

is always true, which results in an infinite loop => crashing the page.

I did take a look at where the reserved aliases are set, they are set here:

src/Umbraco.ModelsBuilder.Embedded/BackOffice/ContentTypeModelValidatorBase.cs

    //don't let them match any properties or methods in IPublishedContent
            //TODO: There are probably more!
            var reservedProperties = typeof(IPublishedContent).GetProperties().Select(x => x.Name).ToArray();
            var reservedMethods = typeof(IPublishedContent).GetMethods().Select(x => x.Name).ToArray();

Adding "parentNode" to these would fix this, but then you should probably add any of the js properties? https://developer.mozilla.org/en-US/docs/Web/API/Node

Be great to help you guys with this, any guidance would be awesome.

umbrabot commented 2 years ago

Hiya @Lantzify,

Just wanted to let you know that we noticed that this issue got a bit stale and might not be relevant any more.

We will close this issue for now but we're happy to open it up again if you think it's still relevant (for example: it's a feature request that's not yet implemented, or it's a bug that's not yet been fixed).

To open it this issue up again, you can write @umbrabot still relevant in a new comment as the first line. It would be super helpful for us if on the next line you could let us know why you think it's still relevant.

For example:

@umbrabot still relevant This bug can still be reproduced in version x.y.z

This will reopen the issue in the next few hours.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face: