asp.net mvc - View Model Identifier -
i attempting started on new asp.net mvc4 project , have few questions regarding view model security.
say have class represent application users
public class user { public int userid { get; set; } public string name { get; set; } }
and class represent tasks application user
public class usertask { public int taskid { get; set; } public int userid { get; set; } public string task { get; set; } }
my coworker seems think view model representation of usertask class should not contain userid security purposes (to prevent people tampering userid).
example
public class usertaskviewmodel { public int taskid { get; set; } public string task { get; set; } }
i can not life of me find documentation supporting claim , haven't been able straight answer.
is common thing? should viewmodel "hide" specific properties view security purposes? understand if data comes model binding tampered with, trying figure out preferred method/best practice scenario.
exposing userid potential security concern, because:
- you revealing information ,
- it can tampered with.
if listing tasks different users, need know user each task. guess obfuscate userid, or when interact task (edit/delete), can check user has access.
if user allowed interact own tasks, there no need include userid know user is.
Comments
Post a Comment