views:

23

answers:

1

What are the security implications of websites accessing database views instead of using stored procedures? The views in question are only being read from; not written to.

Edit

The applications in question are ASP.Net MVC 2 using the Entity Framework (v.4).

+2  A: 

One security implication - probably the biggest: Views leave you open to the same SQL Injection flaws that accessing tables directly does, if you're building your select statement based on user input.

That's about it, and only if you're basing your SQL statement on input. If you just have a view that is static and you never filter or sort based on input, just select fields from the view, you're no safer or less safe with a stored procedure that returns the same results without parameters.

Other than that, using stored procedures is, in my opinion, just a good habit, and in SQL Server you get optimization features from stored procedures, but that's not security related.

David Stratton
Good to know. I'm retrieving some IDs from user controls, but no "custom" user input. Data is included in Linq statements and lambda expressions and - where appropriate - is sanitised first.
Phil.Wheeler