SlideShare a Scribd company logo
SQL: Permissions & Data
Protection
Part 1
    http://www.LearnNowOnline.com




         Learn More @ http://www.learnnowonline.com
         Copyright © by Application Developers Training Company
Objectives
• Understand permissions in SQL Server and how
  they provide granular control over data and
  objects
• Learn how to provide a final layer of defense
  by encrypting data




            Learn More @ http://www.learnnowonline.com
             Copyright © by Application Developers Training Company
Agenda
• Permissions
• Data Encryption
• Security Epilogue




             Learn More @ http://www.learnnowonline.com
             Copyright © by Application Developers Training Company
Permissions
• Like a visa for visiting a foreign country
• Gives a principal some kind of access to a
  securable object
• Follow the principle of least privilege
  • Major step in securing a database




              Learn More @ http://www.learnnowonline.com
              Copyright © by Application Developers Training Company
Permission Types
• A few common types                                  • IMPERSONATE
  • CONTROL                                           • INSERT
  • CREATE                                            • SELECT
  • ALTER                                             • TAKE OWNERSHIP
  • ALTER ANY <objecttype>                            • UPDATE
  • DELETE                                            • VIEW DEFINITION




                 Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Permission Statements
• Three types of statements
  • GRANT
  • REVOKE
  • DENY
• Denying permissions is powerful




             Learn More @ http://www.learnnowonline.com
             Copyright © by Application Developers Training Company
Granting Permissions
• Easiest way to grant permissions in
  Management Studio: modify user or role
• Can also modify properties of individual objects
  • Same effect, but tedious




              Learn More @ http://www.learnnowonline.com
              Copyright © by Application Developers Training Company
Roles, Permissions, and Schemas
• Fully qualified database object name:
  server.database.schema.object
• Schema




• Can assign permissions to schema
• Can set a default schema for a user
             Learn More @ http://www.learnnowonline.com
             Copyright © by Application Developers Training Company
Default Schemas
• Schema is a container for database objects
  • Owned by a principal




• Benefit: better management of object
  ownership

              Learn More @ http://www.learnnowonline.com
              Copyright © by Application Developers Training Company
Default Schemas for Users
• SQL Server doesn’t automatically create a
  schema with same name as user
  • Have to explicitly create it, assign ownership, and
    add objects
• Normally, you should assign a default user




               Learn More @ http://www.learnnowonline.com
               Copyright © by Application Developers Training Company
Default Schemas for Groups
• Default schemas for users solved a problem
• But created a problematic side effect
• Default schemas for groups solves that new
  problem




             Learn More @ http://www.learnnowonline.com
             Copyright © by Application Developers Training Company
Execution Context
• SQL Server follows a procedure to ensure user has
  permissions to execute code
• Exception is when code owner has permissions on
  underlying objects
• Steps
  1. Verify caller has EXECUTE permission
  2. Check if code owner owns all underlying objects
  3. If not, check if user has permissions
  4. If have permissions, execute code
  5. If doesn’t have permissions, raise error, don’t execute

                Learn More @ http://www.learnnowonline.com
                 Copyright © by Application Developers Training Company
Ownership Chaining
• Owner of code owns underlying objects
• If not: broken ownership chain
• Generally easier to write code with unbroken
  ownership chains
• Now can change the security execution context
  of code



            Learn More @ http://www.learnnowonline.com
             Copyright © by Application Developers Training Company
Changing the Execution Context
• Don’t always want caller’s permissions used to
  validate permissions in broken ownership chain
• Can change in any code except inline table-valued
  function
• Options
  • EXECUTE AS CALLER
  • EXECUTE AS <user>/<login>
  • EXECUTE AS SELF
  • EXECUTE AS OWNER
• Must have IMPERSONATE permission
               Learn More @ http://www.learnnowonline.com
               Copyright © by Application Developers Training Company
Metadata Security
• Earlier versions of SQL Server made it easy for
  an attacker to explore structure of database
  • Just needed any access to database
• Metadata is as secure as data is




             Learn More @ http://www.learnnowonline.com
              Copyright © by Application Developers Training Company
Agenda
• Permissions
• Data Encryption
• Security Epilogue




             Learn More @ http://www.learnnowonline.com
             Copyright © by Application Developers Training Company
End of Part 1

    http://www.LearnNowOnline.com




         Learn More @ http://www.learnnowonline.com
         Copyright © by Application Developers Training Company

More Related Content

PDF
Word press as your company website
PPTX
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
PDF
Take a load off! Load testing your Oracle APEX or JDeveloper web applications
PDF
Custom Tile Generation in PCF
PPTX
Securing SharePoint Apps with OAuth
PDF
Git and Github - a 90 Minute interactive workshop
PPTX
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developers
PDF
Создание API, которое полюбят разработчики. Глубокое погружение
Word press as your company website
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Take a load off! Load testing your Oracle APEX or JDeveloper web applications
Custom Tile Generation in PCF
Securing SharePoint Apps with OAuth
Git and Github - a 90 Minute interactive workshop
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developers
Создание API, которое полюбят разработчики. Глубокое погружение

What's hot (20)

PDF
Microservices Architecture for AEM
PDF
Beyond Domino Designer
PPTX
Chris O'Brien - Modern SharePoint development: techniques for moving code off...
PDF
Designing your API Server for mobile apps
PPTX
Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps
PPTX
Automated Testing for Websites With Selenium IDE
PPT
Windows Azure Essentials V3
PDF
AEM Asset and Tag API
PPTX
Vaadin filtering table example
PPTX
Active Directory Single Sign-On with IBM
PPTX
Selenium WebDriver - Test automation for web applications
PPTX
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
PDF
Cross-Platform Desktop Apps with Electron (Condensed Version)
PPTX
Chris OBrien - Weaving Enterprise Solutions into Office Products
PPTX
ECS 2018: Introduction to Azure Web Applications
PDF
Automated testing APEX Applications
PDF
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
PPTX
Aws User Group Singapore Presentation Oct-21-2020
PPT
Drupal Bootcamp Mcn2008
PPTX
COB - Azure Functions for Office 365 developers
Microservices Architecture for AEM
Beyond Domino Designer
Chris O'Brien - Modern SharePoint development: techniques for moving code off...
Designing your API Server for mobile apps
Chris O'Brien - Comparing SharePoint add-ins (apps) with Office 365 apps
Automated Testing for Websites With Selenium IDE
Windows Azure Essentials V3
AEM Asset and Tag API
Vaadin filtering table example
Active Directory Single Sign-On with IBM
Selenium WebDriver - Test automation for web applications
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
Cross-Platform Desktop Apps with Electron (Condensed Version)
Chris OBrien - Weaving Enterprise Solutions into Office Products
ECS 2018: Introduction to Azure Web Applications
Automated testing APEX Applications
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
Aws User Group Singapore Presentation Oct-21-2020
Drupal Bootcamp Mcn2008
COB - Azure Functions for Office 365 developers
Ad

Viewers also liked (8)

KEY
WPF Binding
KEY
WPF: Working with Data
KEY
Asynchronous Programming
PPT
New in the Visual Studio 2012 IDE
PPT
Windows 8: Shapes and Geometries
KEY
Attributes, reflection, and dynamic programming
PDF
Lesson 5 security
PPT
SQL Tutorial - Basic Commands
WPF Binding
WPF: Working with Data
Asynchronous Programming
New in the Visual Studio 2012 IDE
Windows 8: Shapes and Geometries
Attributes, reflection, and dynamic programming
Lesson 5 security
SQL Tutorial - Basic Commands
Ad

Similar to SQL: Permissions and Data Protection (20)

KEY
SQL Server: Security
PPTX
Introduction to cypress in Angular (Chinese)
PPTX
Sharing and security in Salesforce
PDF
THEFT-PROOF JAVA EE - SECURING YOUR JAVA EE APPLICATIONS
PPSX
apex security demo.ppsx
PDF
Cache Security- The Basics
KEY
What's new in Silverlight 5
PPTX
Oracle Database
PDF
Five Enterprise Development Best Practices That EVERY Salesforce Org Can Use
PPTX
8 cloud design patterns you ought to know - Update Conference 2018
PDF
DevSum - Top Azure security fails and how to avoid them
KEY
Object-Oriented JavaScript
PPTX
Five Enterprise Best Practices That EVERY Salesforce Org Can Use (DF15 Session)
PPTX
Power of Azure Devops
PPTX
Oracle database threats - LAOUC Webinar
PPTX
Cloud Platforms for Java
KEY
SharePoint Document Management
PPTX
Cloud patterns at Carleton University
PDF
IT Camp 19: Top Azure security fails and how to avoid them
PDF
Tech Talk on Cloud Computing
SQL Server: Security
Introduction to cypress in Angular (Chinese)
Sharing and security in Salesforce
THEFT-PROOF JAVA EE - SECURING YOUR JAVA EE APPLICATIONS
apex security demo.ppsx
Cache Security- The Basics
What's new in Silverlight 5
Oracle Database
Five Enterprise Development Best Practices That EVERY Salesforce Org Can Use
8 cloud design patterns you ought to know - Update Conference 2018
DevSum - Top Azure security fails and how to avoid them
Object-Oriented JavaScript
Five Enterprise Best Practices That EVERY Salesforce Org Can Use (DF15 Session)
Power of Azure Devops
Oracle database threats - LAOUC Webinar
Cloud Platforms for Java
SharePoint Document Management
Cloud patterns at Carleton University
IT Camp 19: Top Azure security fails and how to avoid them
Tech Talk on Cloud Computing

More from LearnNowOnline (20)

KEY
A tour of SQL Server
KEY
Introducing LINQ
KEY
Generics
KEY
Object oriented techniques
KEY
SharePoint: Introduction to InfoPath
KEY
Managing site collections
KEY
Web API HTTP Pipeline
KEY
Web API Basics
KEY
Sql 2012 development and programming
KEY
KnockOutJS with ASP.NET MVC
KEY
Expression Blend Motion & Interaction Design
KEY
The Entity Data Model
KEY
Introducing the Entity Framework
KEY
Introduction to ASP.NET MVC
KEY
Working with Controllers and Actions in MVC
KEY
Creating a User Interface
KEY
Building Windows 8 Metro Style Applications Using JavaScript and HTML5
KEY
.Net branching and flow control
KEY
Using The .NET Framework
KEY
.NET Variables and Data Types
A tour of SQL Server
Introducing LINQ
Generics
Object oriented techniques
SharePoint: Introduction to InfoPath
Managing site collections
Web API HTTP Pipeline
Web API Basics
Sql 2012 development and programming
KnockOutJS with ASP.NET MVC
Expression Blend Motion & Interaction Design
The Entity Data Model
Introducing the Entity Framework
Introduction to ASP.NET MVC
Working with Controllers and Actions in MVC
Creating a User Interface
Building Windows 8 Metro Style Applications Using JavaScript and HTML5
.Net branching and flow control
Using The .NET Framework
.NET Variables and Data Types

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Approach and Philosophy of On baking technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Cloud computing and distributed systems.
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPT
Teaching material agriculture food technology
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Big Data Technologies - Introduction.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Network Security Unit 5.pdf for BCA BBA.
Approach and Philosophy of On baking technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Cloud computing and distributed systems.
Encapsulation_ Review paper, used for researhc scholars
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
Teaching material agriculture food technology
Machine learning based COVID-19 study performance prediction
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Reach Out and Touch Someone: Haptics and Empathic Computing
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Understanding_Digital_Forensics_Presentation.pptx
Big Data Technologies - Introduction.pptx

SQL: Permissions and Data Protection

  • 1. SQL: Permissions & Data Protection Part 1 http://www.LearnNowOnline.com Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 2. Objectives • Understand permissions in SQL Server and how they provide granular control over data and objects • Learn how to provide a final layer of defense by encrypting data Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 3. Agenda • Permissions • Data Encryption • Security Epilogue Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 4. Permissions • Like a visa for visiting a foreign country • Gives a principal some kind of access to a securable object • Follow the principle of least privilege • Major step in securing a database Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 5. Permission Types • A few common types • IMPERSONATE • CONTROL • INSERT • CREATE • SELECT • ALTER • TAKE OWNERSHIP • ALTER ANY <objecttype> • UPDATE • DELETE • VIEW DEFINITION Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 6. Permission Statements • Three types of statements • GRANT • REVOKE • DENY • Denying permissions is powerful Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 7. Granting Permissions • Easiest way to grant permissions in Management Studio: modify user or role • Can also modify properties of individual objects • Same effect, but tedious Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 8. Roles, Permissions, and Schemas • Fully qualified database object name: server.database.schema.object • Schema • Can assign permissions to schema • Can set a default schema for a user Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 9. Default Schemas • Schema is a container for database objects • Owned by a principal • Benefit: better management of object ownership Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 10. Default Schemas for Users • SQL Server doesn’t automatically create a schema with same name as user • Have to explicitly create it, assign ownership, and add objects • Normally, you should assign a default user Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 11. Default Schemas for Groups • Default schemas for users solved a problem • But created a problematic side effect • Default schemas for groups solves that new problem Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 12. Execution Context • SQL Server follows a procedure to ensure user has permissions to execute code • Exception is when code owner has permissions on underlying objects • Steps 1. Verify caller has EXECUTE permission 2. Check if code owner owns all underlying objects 3. If not, check if user has permissions 4. If have permissions, execute code 5. If doesn’t have permissions, raise error, don’t execute Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 13. Ownership Chaining • Owner of code owns underlying objects • If not: broken ownership chain • Generally easier to write code with unbroken ownership chains • Now can change the security execution context of code Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 14. Changing the Execution Context • Don’t always want caller’s permissions used to validate permissions in broken ownership chain • Can change in any code except inline table-valued function • Options • EXECUTE AS CALLER • EXECUTE AS <user>/<login> • EXECUTE AS SELF • EXECUTE AS OWNER • Must have IMPERSONATE permission Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 15. Metadata Security • Earlier versions of SQL Server made it easy for an attacker to explore structure of database • Just needed any access to database • Metadata is as secure as data is Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 16. Agenda • Permissions • Data Encryption • Security Epilogue Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
  • 17. End of Part 1 http://www.LearnNowOnline.com Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company

Editor's Notes

  • #8: DEMO – rest of section
  • #9: DEMO – rest of section
  • #11: DEMO – rest of section
  • #12: DEMO – rest of section
  • #15: DEMO – Using the EXECUTE AS Clause section
  • #16: DEMO – rest of section