SlideShare a Scribd company logo
Row level security
Row Level Security
SQLschool.gr
Team
Antonios Chatzipavlis
SQL Server Evangelist • Trainer
Vassilis Ioannidis
SQL Server Expert • Trainer
Fivi Panopoulou
System Engineer • Speaker
Sotiris Karras
System Engineer • Speaker
Followus
insocialmedia
@sqlschool /@SotKarras
fb/sqlschoolgr
yt/c/SqlschoolGr
SQL School Greece group
Helpneeded?
help@sqlschool.gr
Presentation
Content
 Overview
 Setting up RLS
 Filter Predicates
 Blocking Predicates
 Best Practices
 Considerations and Limitations
 First introduced in Azure SQL, in January 2015.
 Row Level Security(RLS) enables the implementation of restrictions on data
row access.
 Row level security introduces predicate based access control where the
predicate is used as a criterion to determine whether or not the user has
the appropriate access to the data.
 The predicate can be anything from the characteristics of the user
executing the query (role membership, execution context) to complex
business logic involving multiple tables of the database to SQL Server
metadata.
 The enforcement logic lies inside the database and schema is bound to
the table.
Overview
Overview
Fine-grained
access control
Application
transparency
RLS works transparently at
query time, no app changes
needed
Compatible with RLS in other
leading products
Centralized
security logic
Enforcement logic resides
inside database and is
schema-bound to the table it
protects providing greater
security. Reduced application
maintenance and complexity
Store data intended for many consumers in a single database/table while at the same time restricting row-level read and write access based on users’ execution
context.
Setting Up RLS
 Predicate Function
 Security Predicates
 Security Policies
Predicate function
 User-defined inline table-valued function (iTVF) implementing security logic.
 Schema bound to the table so that no changes can be done to the security policy
under the hood.
 Can be arbitrarily complicated, containing joins with other tables.
 Performance wise, predicate functions get optimized to provide comparable
performance to views, as if the logic were directly embedded in the original
query statement.
 Still, the more complex the security logic gets, the heavier the performance
impact may get.
Predicate Function
Security Predicate
 Binds a predicate function to a particular table, applying it for all queries.
 Two types of predicates: filter predicates and blocking predicates (more on that
in a bit).
Security Predicate
Security policy
 Collection of security predicates for managing security across multiple tables.
 Can be turned on and off at will (STATE = ON|OFF).
 Can be created either by using SCHEMABINDING or not. The recommended (and
default) practice is with SCHEMABINDING on.
 Attempts to alter the columns of a table referenced by a schema bound security
policy will result in an error. However, columns not referenced by the predicate
can be altered.
 Attempts to add a predicate on a table that already has one defined for the
specified operation (regardless of whether it is enabled or disabled) results in an
error.
 Defining multiple active security policies that contain non-overlapping
predicates, succeeds.
Security Policy
Filter Predicates
 Filter predicates are applied while reading data from the base table, and it affects
all get operations.
 SELECT statements.
 DELETE statements (i.e. user cannot delete rows that are filtered).
 UPDATE statements (i.e. user cannot update rows that are filtered, although it is possible to update rows
in such way that they will be subsequently filtered).
 A filter predicate will silently filter out the rows that fail to pass the security
predicate.
 That means that no error message will be returned to the user if he tries to update or delete rows that
he is not allowed to.
 The application can INSERT any rows, regardless of whether or not they will be
filtered during any other operation.
 If the dbo user, a member of the db_owner role, or the table owner queries against
a table that has a security policy defined and enabled the rows are
filtered/restricted as defined by the security policy.
Filter Predicates
RLS and Filter predicates
Blocking Predicates
 Enforce granular control over write access to data for different users, including
scenarios that require separate access logic for INSERT, UPDATE, and DELETE
operations.
 Blocking predicates affect ALL write operations (inserts/updates/deletes).
 Four options to choose from when declaring a blocking predicate:
 AFTER INSERT and AFTER UPDATE predicates can prevent users from updating rows to values that
violate the predicate.
 BEFORE UPDATE predicates can prevent users from updating rows that currently violate the predicate.
 BEFORE DELETE predicates can block delete operations.
 If none of the above is set then the predicate covers every operation.
Blocking Predicates
Putting Everything together
Best Practices
 Create a separate schema for the security objects.
 And give permissions to that schema to the security manager.
 Additionally the security manager does not require any additional permissions to
the underlying tables.
 Avoid type conversions in the predicate functions and be very careful of
mismatches.
 Recursion can be used.
 If the recursion is direct the optimizer will detect it and optimize it accordingly.
 If the recursion is indirect (e.g. the predicate function uses another function that calls the predicate
function) then the optimizer cannot detect the recursion and a performance issue may occur.
 Do not rely on SET options, especially session-specific ones.
 Keep the security logic as simple as possible to allow easy maintenance and
minimal performance degradation.
Best Practices
Considerations and Limitations
 DBCC SHOW_STATISTICS will show statistics of unfiltered data.
 When using columnstore indexes, it is possible that the optimizer may modify the
query plan such that it does not use batch mode, because row-level security
applies a function.
 Temporal tables are compatible with RLS but the security policy must be applied
individually in each table (current and history).
 Memory optimized tables are compatible with RLS. The predicate function must be
defined using the NATIVE_COMPILATION option.
 Partitioned views are compatible with filter predicates but not with blocking predicates.
 That means that a partitioned view CANNOT be created on top of a table with a block predicate defined
on it.
 Security policies can be created on top of indexed views BUT the creation of
indexed views on top of tables that have a security policy is prohibited. (row
lookups through the inde bypass the policy).
 Row-Level security is incompatible with Filestream.
 RLS is incompatible with Polybase.
Considerations and Limitations
Row level security
Row level security
S E L E C T K N O W L E D G E F R O M S Q L S E R V E R
Copyright © 2015 SQLschool.gr. All right reserved.
PRESENTER MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION

More Related Content

PPTX
Power BI - Row Level Security
JAZ Rathor
 
PDF
Power BI - Dynamic role level security
Lorenzo Vercellati
 
PPTX
Power bi overview of static row level security
ManishK55
 
PPTX
Row-level security and Dynamic Data Masking
SolidQ
 
PDF
LG전자 - Amazon Aurora 및 RDS 블루/그린 배포를 이용한 데이터베이스 업그레이드 안정성 확보 - 발표자: 이은경 책임, L...
Amazon Web Services Korea
 
PDF
Azure security architecture
Karl Ots
 
PDF
AWS Summit Seoul 2023 | 다중 계정 및 하이브리드 환경에서 안전한 IAM 체계 만들기
Amazon Web Services Korea
 
PPT
Introduction To Msbi By Yasir
guest7c8e5f
 
Power BI - Row Level Security
JAZ Rathor
 
Power BI - Dynamic role level security
Lorenzo Vercellati
 
Power bi overview of static row level security
ManishK55
 
Row-level security and Dynamic Data Masking
SolidQ
 
LG전자 - Amazon Aurora 및 RDS 블루/그린 배포를 이용한 데이터베이스 업그레이드 안정성 확보 - 발표자: 이은경 책임, L...
Amazon Web Services Korea
 
Azure security architecture
Karl Ots
 
AWS Summit Seoul 2023 | 다중 계정 및 하이브리드 환경에서 안전한 IAM 체계 만들기
Amazon Web Services Korea
 
Introduction To Msbi By Yasir
guest7c8e5f
 

What's hot (20)

PPTX
Introduction to Microsoft Power BI
Exilesoft
 
PDF
AWS Summit Seoul 2023 | 데이터, 분석 및 AI를 통합하는 단 하나의 레이크하우스, Databricks on AWS 로 ...
Amazon Web Services Korea
 
PDF
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
Amazon Web Services Korea
 
PDF
Make Your Application “Oracle RAC Ready” & Test For It
Markus Michalewicz
 
PPTX
Oracle Database Vaultのご紹介
オラクルエンジニア通信
 
PDF
db tech showcase 2019 D10 Oracle Database New Features
Noriyoshi Shinoda
 
DOC
Authorisation Concept In SAP | http://sapdocs.info
sapdocs. info
 
PPT
Oracle Architecture
Neeraj Singh
 
PDF
Sap basis administrator user guide
PoguttuezhiniVP
 
PPTX
Oracle dba training
P S Rani
 
PPTX
Dbms and rdbms
Umair Shakir
 
PPT
Sql Server Basics
rainynovember12
 
PDF
Oracle Security Presentation
Francisco Alvarez
 
PDF
DMS와 SCT를 활용한 Oracle에서 Open Source DB로의 전환
Amazon Web Services Korea
 
PPT
Ms sql server architecture
Ajeet Singh
 
PPSX
Ppt dbsec-oow2013-avdf
Melody Liu
 
PPTX
Database Administrator
Dhrumil Panchal
 
PPTX
Sql server logshipping
Zeba Ansari
 
PPTX
Introduction of DBMS
YouQue ™
 
PDF
Oracle DB를 AWS로 이관하는 방법들 - 서호석 클라우드 사업부/컨설팅팀 이사, 영우디지탈 :: AWS Summit Seoul 2021
Amazon Web Services Korea
 
Introduction to Microsoft Power BI
Exilesoft
 
AWS Summit Seoul 2023 | 데이터, 분석 및 AI를 통합하는 단 하나의 레이크하우스, Databricks on AWS 로 ...
Amazon Web Services Korea
 
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
Amazon Web Services Korea
 
Make Your Application “Oracle RAC Ready” & Test For It
Markus Michalewicz
 
Oracle Database Vaultのご紹介
オラクルエンジニア通信
 
db tech showcase 2019 D10 Oracle Database New Features
Noriyoshi Shinoda
 
Authorisation Concept In SAP | http://sapdocs.info
sapdocs. info
 
Oracle Architecture
Neeraj Singh
 
Sap basis administrator user guide
PoguttuezhiniVP
 
Oracle dba training
P S Rani
 
Dbms and rdbms
Umair Shakir
 
Sql Server Basics
rainynovember12
 
Oracle Security Presentation
Francisco Alvarez
 
DMS와 SCT를 활용한 Oracle에서 Open Source DB로의 전환
Amazon Web Services Korea
 
Ms sql server architecture
Ajeet Singh
 
Ppt dbsec-oow2013-avdf
Melody Liu
 
Database Administrator
Dhrumil Panchal
 
Sql server logshipping
Zeba Ansari
 
Introduction of DBMS
YouQue ™
 
Oracle DB를 AWS로 이관하는 방법들 - 서호석 클라우드 사업부/컨설팅팀 이사, 영우디지탈 :: AWS Summit Seoul 2021
Amazon Web Services Korea
 
Ad

Viewers also liked (10)

PDF
Exploring sql server 2016 bi
Antonios Chatzipavlis
 
PDF
Introduction to Machine Learning on Azure
Antonios Chatzipavlis
 
PDF
Introduction to sql database on azure
Antonios Chatzipavlis
 
PDF
Live Query Statistics & Query Store in SQL Server 2016
Antonios Chatzipavlis
 
PDF
Microsoft SQL Family and GDPR
Antonios Chatzipavlis
 
PDF
Dynamic data masking sql server 2016
Antonios Chatzipavlis
 
PDF
Introduction to azure document db
Antonios Chatzipavlis
 
PDF
Exploring sql server 2016
Antonios Chatzipavlis
 
PDF
Introduction to Azure Data Lake
Antonios Chatzipavlis
 
PDF
Azure SQL Data Warehouse
Antonios Chatzipavlis
 
Exploring sql server 2016 bi
Antonios Chatzipavlis
 
Introduction to Machine Learning on Azure
Antonios Chatzipavlis
 
Introduction to sql database on azure
Antonios Chatzipavlis
 
Live Query Statistics & Query Store in SQL Server 2016
Antonios Chatzipavlis
 
Microsoft SQL Family and GDPR
Antonios Chatzipavlis
 
Dynamic data masking sql server 2016
Antonios Chatzipavlis
 
Introduction to azure document db
Antonios Chatzipavlis
 
Exploring sql server 2016
Antonios Chatzipavlis
 
Introduction to Azure Data Lake
Antonios Chatzipavlis
 
Azure SQL Data Warehouse
Antonios Chatzipavlis
 
Ad

Similar to Row level security (20)

PDF
oracle
tarunamoria
 
PDF
OER Unit 4 Virtual Private Database
Girija Muscut
 
PPTX
Active database system
Adeolu Olaniyan
 
PPTX
Active database
mridul mishra
 
PPTX
Data Redaction - OTN TOUR LA 2015
Alex Zaballa
 
PPTX
Database modeling and security
Neeharika Nidadavolu
 
PDF
Sql server 2016 new features
Ajeet Singh
 
PDF
Sql server 2016 new features
Ajeet pratap Singh
 
PPT
Less11 Security
vivaankumar
 
PDF
Database security issues
n|u - The Open Security Community
 
PDF
Data base Access Control a look at Fine grain Access method
International Journal of Engineering Inventions www.ijeijournal.com
 
DOCX
ICT-DBA4-09-0811-Monitor-and-Administer-Database.docx
AmanGunner
 
PPTX
Ebook5
kaashiv1
 
PPTX
Sql interview question part 5
kaashiv1
 
PPT
New Features Sql 2008
tomerl
 
PPTX
Database concepts
shanthishyam
 
PPT
DB2 LUW Auditing
DB2Locksmith
 
PPTX
Oracle Data Redaction
Alex Zaballa
 
PPTX
ch20 Secuity & Admin Transparencies-6E.pptx
alhashediyemen1
 
PDF
snowpro-core.pdf dumps 2025 latest pdf .
divinefer59
 
oracle
tarunamoria
 
OER Unit 4 Virtual Private Database
Girija Muscut
 
Active database system
Adeolu Olaniyan
 
Active database
mridul mishra
 
Data Redaction - OTN TOUR LA 2015
Alex Zaballa
 
Database modeling and security
Neeharika Nidadavolu
 
Sql server 2016 new features
Ajeet Singh
 
Sql server 2016 new features
Ajeet pratap Singh
 
Less11 Security
vivaankumar
 
Database security issues
n|u - The Open Security Community
 
Data base Access Control a look at Fine grain Access method
International Journal of Engineering Inventions www.ijeijournal.com
 
ICT-DBA4-09-0811-Monitor-and-Administer-Database.docx
AmanGunner
 
Ebook5
kaashiv1
 
Sql interview question part 5
kaashiv1
 
New Features Sql 2008
tomerl
 
Database concepts
shanthishyam
 
DB2 LUW Auditing
DB2Locksmith
 
Oracle Data Redaction
Alex Zaballa
 
ch20 Secuity & Admin Transparencies-6E.pptx
alhashediyemen1
 
snowpro-core.pdf dumps 2025 latest pdf .
divinefer59
 

More from Antonios Chatzipavlis (20)

PPTX
Data virtualization using polybase
Antonios Chatzipavlis
 
PDF
SQL server Backup Restore Revealed
Antonios Chatzipavlis
 
PDF
Migrate SQL Workloads to Azure
Antonios Chatzipavlis
 
PDF
Machine Learning in SQL Server 2019
Antonios Chatzipavlis
 
PDF
Workload Management in SQL Server 2019
Antonios Chatzipavlis
 
PDF
Loading Data into Azure SQL DW (Synapse Analytics)
Antonios Chatzipavlis
 
PDF
Introduction to DAX Language
Antonios Chatzipavlis
 
PDF
Building diagnostic queries using DMVs and DMFs
Antonios Chatzipavlis
 
PDF
Exploring T-SQL Anti-Patterns
Antonios Chatzipavlis
 
PDF
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
PDF
Modernizing your database with SQL Server 2019
Antonios Chatzipavlis
 
PDF
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
PDF
SQLServer Database Structures
Antonios Chatzipavlis
 
PDF
Sqlschool 2017 recap - 2018 plans
Antonios Chatzipavlis
 
PDF
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Antonios Chatzipavlis
 
PDF
Statistics and Indexes Internals
Antonios Chatzipavlis
 
PDF
Implementing Mobile Reports in SQL Sserver 2016 Reporting Services
Antonios Chatzipavlis
 
PDF
Auditing Data Access in SQL Server
Antonios Chatzipavlis
 
PDF
Stretch db sql server 2016 (sn0028)
Antonios Chatzipavlis
 
PDF
Troubleshooting sql server
Antonios Chatzipavlis
 
Data virtualization using polybase
Antonios Chatzipavlis
 
SQL server Backup Restore Revealed
Antonios Chatzipavlis
 
Migrate SQL Workloads to Azure
Antonios Chatzipavlis
 
Machine Learning in SQL Server 2019
Antonios Chatzipavlis
 
Workload Management in SQL Server 2019
Antonios Chatzipavlis
 
Loading Data into Azure SQL DW (Synapse Analytics)
Antonios Chatzipavlis
 
Introduction to DAX Language
Antonios Chatzipavlis
 
Building diagnostic queries using DMVs and DMFs
Antonios Chatzipavlis
 
Exploring T-SQL Anti-Patterns
Antonios Chatzipavlis
 
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
Modernizing your database with SQL Server 2019
Antonios Chatzipavlis
 
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
SQLServer Database Structures
Antonios Chatzipavlis
 
Sqlschool 2017 recap - 2018 plans
Antonios Chatzipavlis
 
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Antonios Chatzipavlis
 
Statistics and Indexes Internals
Antonios Chatzipavlis
 
Implementing Mobile Reports in SQL Sserver 2016 Reporting Services
Antonios Chatzipavlis
 
Auditing Data Access in SQL Server
Antonios Chatzipavlis
 
Stretch db sql server 2016 (sn0028)
Antonios Chatzipavlis
 
Troubleshooting sql server
Antonios Chatzipavlis
 

Recently uploaded (20)

PPTX
MR and reffffffvvvvvvvfversal_083605.pptx
manjeshjain
 
PDF
Key_Statistical_Techniques_in_Analytics_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
blockchain123456789012345678901234567890
tanvikhunt1003
 
PPTX
HSE WEEKLY REPORT for dummies and lazzzzy.pptx
ahmedibrahim691723
 
PPTX
Fluvial_Civilizations_Presentation (1).pptx
alisslovemendoza7
 
PPTX
Introduction to computer chapter one 2017.pptx
mensunmarley
 
PDF
D9110.pdfdsfvsdfvsdfvsdfvfvfsvfsvffsdfvsdfvsd
minhn6673
 
PDF
Fundamentals and Techniques of Biophysics and Molecular Biology (Pranav Kumar...
RohitKumar868624
 
PPTX
Multiscale Segmentation of Survey Respondents: Seeing the Trees and the Fores...
Sione Palu
 
PPTX
INFO8116 -Big data architecture and analytics
guddipatel10
 
PPTX
Data-Users-in-Database-Management-Systems (1).pptx
dharmik832021
 
PPTX
Databricks-DE-Associate Certification Questions-june-2024.pptx
pedelli41
 
PPTX
Introduction to Biostatistics Presentation.pptx
AtemJoshua
 
PDF
717629748-Databricks-Certified-Data-Engineer-Professional-Dumps-by-Ball-21-03...
pedelli41
 
PPT
From Vision to Reality: The Digital India Revolution
Harsh Bharvadiya
 
PPTX
Presentation on animal welfare a good topic
kidscream385
 
PDF
Blitz Campinas - Dia 24 de maio - Piettro.pdf
fabigreek
 
PPTX
World-population.pptx fire bunberbpeople
umutunsalnsl4402
 
PPTX
Presentation (1) (1).pptx k8hhfftuiiigff
karthikjagath2005
 
PPTX
Introduction to Data Analytics and Data Science
KavithaCIT
 
MR and reffffffvvvvvvvfversal_083605.pptx
manjeshjain
 
Key_Statistical_Techniques_in_Analytics_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
blockchain123456789012345678901234567890
tanvikhunt1003
 
HSE WEEKLY REPORT for dummies and lazzzzy.pptx
ahmedibrahim691723
 
Fluvial_Civilizations_Presentation (1).pptx
alisslovemendoza7
 
Introduction to computer chapter one 2017.pptx
mensunmarley
 
D9110.pdfdsfvsdfvsdfvsdfvfvfsvfsvffsdfvsdfvsd
minhn6673
 
Fundamentals and Techniques of Biophysics and Molecular Biology (Pranav Kumar...
RohitKumar868624
 
Multiscale Segmentation of Survey Respondents: Seeing the Trees and the Fores...
Sione Palu
 
INFO8116 -Big data architecture and analytics
guddipatel10
 
Data-Users-in-Database-Management-Systems (1).pptx
dharmik832021
 
Databricks-DE-Associate Certification Questions-june-2024.pptx
pedelli41
 
Introduction to Biostatistics Presentation.pptx
AtemJoshua
 
717629748-Databricks-Certified-Data-Engineer-Professional-Dumps-by-Ball-21-03...
pedelli41
 
From Vision to Reality: The Digital India Revolution
Harsh Bharvadiya
 
Presentation on animal welfare a good topic
kidscream385
 
Blitz Campinas - Dia 24 de maio - Piettro.pdf
fabigreek
 
World-population.pptx fire bunberbpeople
umutunsalnsl4402
 
Presentation (1) (1).pptx k8hhfftuiiigff
karthikjagath2005
 
Introduction to Data Analytics and Data Science
KavithaCIT
 

Row level security

  • 3. SQLschool.gr Team Antonios Chatzipavlis SQL Server Evangelist • Trainer Vassilis Ioannidis SQL Server Expert • Trainer Fivi Panopoulou System Engineer • Speaker Sotiris Karras System Engineer • Speaker
  • 6. Presentation Content  Overview  Setting up RLS  Filter Predicates  Blocking Predicates  Best Practices  Considerations and Limitations
  • 7.  First introduced in Azure SQL, in January 2015.  Row Level Security(RLS) enables the implementation of restrictions on data row access.  Row level security introduces predicate based access control where the predicate is used as a criterion to determine whether or not the user has the appropriate access to the data.  The predicate can be anything from the characteristics of the user executing the query (role membership, execution context) to complex business logic involving multiple tables of the database to SQL Server metadata.  The enforcement logic lies inside the database and schema is bound to the table. Overview
  • 8. Overview Fine-grained access control Application transparency RLS works transparently at query time, no app changes needed Compatible with RLS in other leading products Centralized security logic Enforcement logic resides inside database and is schema-bound to the table it protects providing greater security. Reduced application maintenance and complexity Store data intended for many consumers in a single database/table while at the same time restricting row-level read and write access based on users’ execution context.
  • 9. Setting Up RLS  Predicate Function  Security Predicates  Security Policies
  • 10. Predicate function  User-defined inline table-valued function (iTVF) implementing security logic.  Schema bound to the table so that no changes can be done to the security policy under the hood.  Can be arbitrarily complicated, containing joins with other tables.  Performance wise, predicate functions get optimized to provide comparable performance to views, as if the logic were directly embedded in the original query statement.  Still, the more complex the security logic gets, the heavier the performance impact may get. Predicate Function
  • 11. Security Predicate  Binds a predicate function to a particular table, applying it for all queries.  Two types of predicates: filter predicates and blocking predicates (more on that in a bit). Security Predicate
  • 12. Security policy  Collection of security predicates for managing security across multiple tables.  Can be turned on and off at will (STATE = ON|OFF).  Can be created either by using SCHEMABINDING or not. The recommended (and default) practice is with SCHEMABINDING on.  Attempts to alter the columns of a table referenced by a schema bound security policy will result in an error. However, columns not referenced by the predicate can be altered.  Attempts to add a predicate on a table that already has one defined for the specified operation (regardless of whether it is enabled or disabled) results in an error.  Defining multiple active security policies that contain non-overlapping predicates, succeeds. Security Policy
  • 14.  Filter predicates are applied while reading data from the base table, and it affects all get operations.  SELECT statements.  DELETE statements (i.e. user cannot delete rows that are filtered).  UPDATE statements (i.e. user cannot update rows that are filtered, although it is possible to update rows in such way that they will be subsequently filtered).  A filter predicate will silently filter out the rows that fail to pass the security predicate.  That means that no error message will be returned to the user if he tries to update or delete rows that he is not allowed to.  The application can INSERT any rows, regardless of whether or not they will be filtered during any other operation.  If the dbo user, a member of the db_owner role, or the table owner queries against a table that has a security policy defined and enabled the rows are filtered/restricted as defined by the security policy. Filter Predicates
  • 15. RLS and Filter predicates
  • 17.  Enforce granular control over write access to data for different users, including scenarios that require separate access logic for INSERT, UPDATE, and DELETE operations.  Blocking predicates affect ALL write operations (inserts/updates/deletes).  Four options to choose from when declaring a blocking predicate:  AFTER INSERT and AFTER UPDATE predicates can prevent users from updating rows to values that violate the predicate.  BEFORE UPDATE predicates can prevent users from updating rows that currently violate the predicate.  BEFORE DELETE predicates can block delete operations.  If none of the above is set then the predicate covers every operation. Blocking Predicates
  • 20.  Create a separate schema for the security objects.  And give permissions to that schema to the security manager.  Additionally the security manager does not require any additional permissions to the underlying tables.  Avoid type conversions in the predicate functions and be very careful of mismatches.  Recursion can be used.  If the recursion is direct the optimizer will detect it and optimize it accordingly.  If the recursion is indirect (e.g. the predicate function uses another function that calls the predicate function) then the optimizer cannot detect the recursion and a performance issue may occur.  Do not rely on SET options, especially session-specific ones.  Keep the security logic as simple as possible to allow easy maintenance and minimal performance degradation. Best Practices
  • 22.  DBCC SHOW_STATISTICS will show statistics of unfiltered data.  When using columnstore indexes, it is possible that the optimizer may modify the query plan such that it does not use batch mode, because row-level security applies a function.  Temporal tables are compatible with RLS but the security policy must be applied individually in each table (current and history).  Memory optimized tables are compatible with RLS. The predicate function must be defined using the NATIVE_COMPILATION option.  Partitioned views are compatible with filter predicates but not with blocking predicates.  That means that a partitioned view CANNOT be created on top of a table with a block predicate defined on it.  Security policies can be created on top of indexed views BUT the creation of indexed views on top of tables that have a security policy is prohibited. (row lookups through the inde bypass the policy).  Row-Level security is incompatible with Filestream.  RLS is incompatible with Polybase. Considerations and Limitations
  • 25. S E L E C T K N O W L E D G E F R O M S Q L S E R V E R Copyright © 2015 SQLschool.gr. All right reserved. PRESENTER MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION