SQL-Server-First-Responder-Kit icon indicating copy to clipboard operation
SQL-Server-First-Responder-Kit copied to clipboard

sp_BlitzCache - check plan for SecurityPolicyApplied="true" (Row Level Security)

Open LitKnd opened this issue 9 years ago • 2 comments

Do you want to request a feature or report a bug? Feature

What is the current behavior? sp_BlitzCache doesn't tell you if an execution plan has some junk it in from a security policy being applied (row level security).

The main reason to add this feature is that it's easy to forget about row level security. If it's on and you're not aware, looking at an execution plan can be confusing AF.

**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via http://sqlfiddle.com Not a bug, but the easiest way to test is to run this query in the WideWorldImporters sample database and look at the plan: SELECT CustomerName FROM Sales.Customers; GO

You'll see a nested loop doing a bunch of junk based on DeliveryCityID, even though you didn't ask for that at all in your query. It's because of the security policy [Application].[FilterCustomersBySalesTerritoryRole] .

What is the expected behavior? It'd be swell if blitzcache checked the plan for SecurityPolicyApplied="true" and listed a warning that row level security added some gibberish.

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures? SQL Server 2016 only.

LitKnd avatar Jan 25 '17 20:01 LitKnd

Oh, I suppose :)

BlitzErik avatar Jan 25 '17 22:01 BlitzErik

Holy crap, that was fast!

LitKnd avatar Jan 26 '17 03:01 LitKnd