Docsity

Database Security and Access Control: Authentication, Authorization, and Privileges, Summaries of Database Programming

Partial preview of the text

Download Database Security and Access Control: Authentication, Authorization, and Privileges and more Summaries Database Programming in PDF only on Docsity!

Security and Authorization

Chapter 5

Chapter outline

 Introduction to DB Security  Security Levels  Access Controls  GRANT and REVOKE of Privileges  GRANT/REVOKE on Views  Role-Based Authorization

Security Levels

 A user passes through 2 stages of security in DBMS  (^) Authentication – validates that a user can connect to a SQL Server instance (Login)  (^) Authorization – permissions validation; controls the activities the user is allowed to perform in the SQL Server database (User) John LOGIN ID Authentication - provides Access to SQL Server SQL Server Instance Northwind Pubs Expense UserName Permissions - provides access to a database Databases

Access Controls

 A security policy specifies who is authorized to do what.  A security mechanism allows us to enforce a chosen security policy.  Two main mechanisms at the DBMS level:  Discretionary access control  (^) Mandatory access control

GRANT Command

 (^) The following privileges can be specified:  (^) SELECT: Can read all columns (including those added later via ALTER TABLE command).  (^) INSERT(col-name): Can insert tuples with non-null or non- default values in this column. INSERT means same right with respect to all columns.  (^) DELETE: Can delete tuples.  (^) REFERENCES (col-name): Can define foreign keys (in other tables) that refer to this column.  (^) If a user has a privilege with the GRANT OPTION, can pass privilege on to other users (with or without passing on the GRANT OPTION).  (^) Only owner can execute CREATE, ALTER, and DROP. GRANT privileges ON object TO users [WITH GRANT OPTION]

8

Revoking Privileges

REVOKE ON FROM <list of authorization ID’s>;  Your grant of these privileges can no longer be used by these users to justify their use of the privilege.  (^) But they may still have the privilege because they obtained it independently from elsewhere.

GRANT and REVOKE of

Privileges

Examples

 GRANT INSERT, SELECT ON Sailors TO Horatio  (^) Horatio can query Sailors or insert tuples into it.  GRANT DELETE ON Sailors TO Yuppy WITH GRANT OPTION  (^) Yuppy can delete tuples, and also authorize others to do so.  GRANT UPDATE ( rating ) ON Sailors TO Dustin  (^) Dustin can update (only) the rating field of Sailors tuples.  GRANT SELECT ON ActiveSailors TO Guppy, Yuppy  (^) This does NOT allow the ‘uppies to query Sailors directly!

11

Example: Privileges

 (^) For the statement below: INSERT INTO Beers(name) SELECT beer FROM Sells WHERE NOT EXISTS (SELECT * FROM Beers WHERE name = beer);  We require privileges SELECT on Sells and Beers, and INSERT on Beers or Beers.name. beers that do not appear in Beers. We add them to Beers with a NULL manufacturer.

13

Example: Grant Diagram

AP** BP* CP* CP A executes REVOKE P FROM B CASCADE; However, C still has P without grant option because of the direct grant. Not only does B lose P, but C loses P. Delete BP* and CP*. Even had C passed P to B, both nodes are still cut off.

GRANT/REVOKE on Views

 If the creator of a view loses the SELECT privilege on an underlying table, the view is dropped!  If the creator of a view loses a privilege held with the grant option on an underlying table, (s)he loses the privilege on the view as well; so do users who were granted that privilege on the view!

16

Authorization ID’s

 A user is referred to by authorization ID , typically their login name.  There is an authorization ID: PUBLIC.  (^) Granting a privilege to PUBLIC makes it available to any authorization ID.

Role-Based Authorization

 (^) In SQL-92, privileges are actually assigned to authorization ids, which can denote a single user or a group of users.  In SQL:1999 (and in many current systems), privileges are assigned to roles.  (^) Allow you to collect users into a single unit against which you can apply permissions  (^) Permissions are applied automatically when the users become members of the role  (^) Roles can then be granted to users and to other roles.  (^) Reflects how real organizations work.  (^) Illustrates how standards often catch up with “de facto” standards embodied in popular systems.

Assigments

 (^) Grant and Revoke in SQL Server or Oracle.  (^) Roles: Server roles, Database roles, Application Roles (Fixed roles và user defined roles)  (^) Roles in security  (^) Creating and management Roles in SQL-Server or Oracle (with Management Studio or transaction (SQL-Server))