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:

  1. you revealing information ,
  2. 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

Popular posts from this blog

Line ending issue with Mercurial or Visual Studio -

java - Jtable duplicate Rows -

java - Run a .jar on Heroku -