Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Remove Html.JavaScriptEncoder property #4033

Closed
blowdart opened this issue Feb 2, 2016 · 5 comments
Closed

Remove Html.JavaScriptEncoder property #4033

blowdart opened this issue Feb 2, 2016 · 5 comments
Assignees
Milestone

Comments

@blowdart
Copy link
Member

blowdart commented Feb 2, 2016

This @ method is unsafe. It needs to be removed.

We've been recommending the safe approach for a couple of years, which is you put the data inside a DIV tag, in a data attribute, at which point @ and HTML encoding works just fine.

There are cases where simply Javascript encoding introduces XSS (for example, outputting into an OnX attribute on an element). The existence of this method encourages folks to do the wrong thing.

@Eilon Eilon added this to the 1.0.0-rc2 milestone Feb 2, 2016
@Eilon Eilon changed the title Remove Html.JavascriptEncode Remove Html.JavaScriptEncoder property Feb 2, 2016
@Eilon
Copy link
Member

Eilon commented Feb 2, 2016

This is the property in question: https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.ViewFeatures/Rendering/IHtmlHelper.cs#L61-L64

It doesn't appear to be used anywhere in MVC, so it should be fairly clean to remove.

@kichalla
Copy link
Member

kichalla commented Feb 3, 2016

bf93c7d

@kichalla kichalla closed this as completed Feb 3, 2016
@gdoron
Copy link

gdoron commented Nov 12, 2016

@blowdart Can you please give me a link to an article showing how can it be exploited?
Having to write the text in html and use javascript to read it is very awkward 😢

Will it ever be safe or just forget about its existence?

@blowdart
Copy link
Member Author

I won't, because it's very use specific. Please just forget about its existence.

@gdoron
Copy link

gdoron commented Nov 14, 2016

Existence of what? 😝
Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants