Mvc: Password value: input vs editor

Created on 1 Mar 2018  路  6Comments  路  Source: aspnet/Mvc

When you use the input helper for a password field, the value attribute is not rendered. When you use the editor helper, the value attribute is rendered. This is how it works in MVC 5, I haven't tried in Core but a quick look at the code tells me it should work the same (see DefaultEditorTemplates.PasswordTemplate.

Is there a reason for this difference?

3 - Done bug S

All 6 comments

Hi @maxtoroq. This behavior is intentional.
The reason is that it can lead to sensitive data to be exposed in clear text on the client side, as in the rendered page that value will be in clear text (in the source of the page).

@mkArtakMSFT You either didn't read or didn't understand. I know the behavior is by design. My question is, why isn't the editor helper behavior consistent?

I indeed misunderstood you, @maxtoroq. Reopening to understand how we should move forward here.

@dougbu, seems like a bug. How hard will it be to fix this?

If we confirm this happens in ASP.NET Core MVC as well, it's a one-line fix. Would need a few tests of course.

I also suggest we add a default display template for passwords.

f061d328d9

Was this page helpful?
0 / 5 - 0 ratings