.net - Where in the call stack should role checks be done? -


In my typical app, the user clicks on a button in the ASPX page, invites a C # business object, Then runs a stored procedure.

What role should be investigated at the top of the stack, under the heap or at every level? It seems that if a malicious user can use a method, then anyone can apply it, so for effective security, you will need to check each method (and it has too much code to write ).

There is a specific call stack to clarify my question:

  Page_Load () {if (p.IsInRole ("Manager")) // or equivalent Attribute {addAccount.Visible = true; }} AddAccount_OnClick () {if (p.IsInRole ("Manager")) // or equivalent attribute {// Add account account.Add (...); // And maybe check another role ...}} - TSQL does not understand NAT authorization, this call is in a 'trusted' subsystem that can be purchased Add_Account @user, @account_name @username (role_table) 

In my opinion, You should keep it close to as much data as possible. The closer you are to the data, the more you can ensure that it is not possible to take some curved route through your code base to prevent the access code.

This argument will call for security checks either in the data source, if it supports it (such as your favorite RDBMS), or data access layer.

However, some security constraints have a strong smell of business logic; Such as "If the user is in this role and tries to modify the data that meets these specifications, then operation should be allowed, otherwise it does not look like a policy for me, and something that is different The rule is in the business logic level of the engine.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -