











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












Chapter 5
Introduction to DB Security Security Levels Access Controls GRANT and REVOKE of Privileges GRANT/REVOKE on Views Role-Based Authorization
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
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
(^) 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
REVOKE ON
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
(^) 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
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.
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
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.
(^) 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.
(^) 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))