• Non ci sono risultati.

DBG Access control DBG Access control

N/A
N/A
Protected

Academic year: 2021

Condividi "DBG Access control DBG Access control"

Copied!
16
0
0

Testo completo

(1)

Databases Access control

Elena Baralis and Tania Cerquitelli

©2013 Politecnico di Torino 1

D B M G

SQL language: other definitions

Access control

D B

M G

2

Access control

Data security

Resources and privileges

Management of privileges in SQL Management of roles in SQL

(2)

D B M G

Access control

Data security

Data security

Protection of data from unauthorized readers alteration or destruction

The DBMS provides protection tools which are defined by the database administrator (DBA)

(3)

Databases Access control

Elena Baralis and Tania Cerquitelli

©2013 Politecnico di Torino 3

D B

M G

5

Data security

Security control verifies that users are authorized to execute the operations they request

Security is guaranteed through a set of constraints

specificied by the DBA in an appropriate language memorized in the data dictionary system

D B M G

Access control

Resources and privileges

(4)

D B

M G

7

Resources

Any component of the database scheme is a resource

table view

attribute in a table or view domain

procedure ...

Resources are protected by the definition of

access privileges

Access privileges

Describe access rights to system resources SQL provides very flexible access control mechanisms for specifying

the resources users can access

the resources that have to remain private

(5)

Databases Access control

Elena Baralis and Tania Cerquitelli

©2013 Politecnico di Torino 5

D B

M G

9

Privileges: characteristics

Each privilege is characterized by the following information

the resource it refers to the type of privilege

describes the action allowed on the resource the user granting the privilege

the user receiving the privilege

the faculty to transmit the privilege to other users

D B

M G

10

Types of privilege (1/2)

INSERT

enables the insertion of a new object in the resource

valid for tables and views UPDATE

enables updating the value of an object valid for tables, views and attributes DELETE

enables removal of objects from the resource valid for tables and views

(6)

D B

M G

11

Types of privilege (2/2)

SELECT

enables using the resource in a query valid for tables and views

REFERENCES

enables referring to a resource in the definition of a table scheme

can be associated with tables and attributes USAGE

enables use of the resource (e.g. a new type of data) in the definition of new schemes

Resource creator privileges

When a resource is created, the system grants all privileges over that resource to the user that created it

Only the resource creator has the privilege to eliminate a resource (DROP) and modify a scheme (ALTER)

the privilege to eliminate and modify a resource cannot be granted to any other user

sp1

(7)

Diapositiva 12

sp1 Would you prefer me to use "eliminate a resource", "modify a scheme" here, or would you prefer

"drop a resource", "alter a scheme"?

sp; 10/02/2013

(8)

D B

M G

13

System administrator privileges

The system administrator (user system)

possesses all privileges over all the resources

Access control

Management of privileges in SQL

(9)

Databases Access control

Elena Baralis and Tania Cerquitelli

©2013 Politecnico di Torino 8

D B

M G

15

Management of privileges in SQL

Privileges are granted or revoked using SQL instructions

GRANT

grants privileges over a resource to one or more users

REVOKE

revokes privileges granted to one or more users

D B

M G

16

GRANT

PrivilegeList

specifies the list of privileges ALL PRIVILEGES

Keyword for identifying all privileges

ResourceName

specifies the resource for which the privilege is granted

UserList

Specifies the users who are granted the privilege GRANTPrivilegeList ON ResourceName TOUserList

[WITH GRANT OPTION]

(10)

D B

M G

17

Example n. 1

Users Black and While are granted all privileges for table P

GRANT ALL PRIVILEGES ONP TOBlack, Whitei

GRANT

WITH GRANT OPTION

faculty to transfer the privilege to other users GRANTPrivilegeList ON ResourceName TOUserList

[WITH GRANT OPTION]

(11)

Databases Access control

Elena Baralis and Tania Cerquitelli

©2013 Politecnico di Torino 10

D B

M G

19

Example n. 2

User Red is granted the privilege to SELECT in table S

User Red has the faculty to grant the privilege to other users

GRANT SELECT ON S TORed

WITH GRANT OPTION

D B

M G

20

REVOKE

The command REVOKE can remove all the privileges that have been granted a subset of privileges granted

REVOKEPrivilegeList ON ResourceName FROMUserList [RESTRICT|CASCADE]

(12)

D B

M G

21

Example n. 1

User White’s privilege to UPDATE table P is revoked

REVOKE UPDATE ON P FROMWhite

REVOKE

RESTRICT

the command must not be executed if revoking the user’s privileges entails revoking other privileges

Example: the user has received the privileges with the GRANT OPTION and has propagated the privileges to other users

default value

REVOKEPrivilegeList ON ResourceName FROMUserList [RESTRICT|CASCADE]

(13)

Databases Access control

Elena Baralis and Tania Cerquitelli

©2013 Politecnico di Torino 12

D B

M G

23

Example n. 1

User White’s privilege to UPDATE table P is revoked

the command is not executed if it entails revoking the privilege of other users

REVOKE UPDATE ON P FROMWhite

D B

M G

24

REVOKE

CASCADE

revokes also all the privileges which have been propagated

generates a chain reaction for each privilege revoked

all granted privileges are revoked in a cascade all database elements which have been created exploiting these privileges are removed

REVOKEPrivilegeList ON ResourceName FROMUserList [RESTRICT|CASCADE]

(14)

D B

M G

25

Example n. 2

User Red’s privilege to SELECT table S is revoked

User Red had received the privilege through GRANT OPTION

if Rossi has propagated the privilege to other users, the privilege is revoked in cascade if Rossi has created a view using the SELECT privilege, the view is removed

REVOKE SELECT ON S FROMRed CASCADE

Access control

Management of roles in SQL

(15)

Databases Access control

Elena Baralis and Tania Cerquitelli

©2013 Politecnico di Torino 14

D B

M G

27

Concept of role (1/2)

The role is an access profile Defined by its set of privileges Each user has a defined role

it enjoys the privileges associated with that role

D B

M G

28

Concept of role (2/2)

Advantages

access control is more flexible

a user can have different roles at different times it simplifies administration

an access profile need not be defined at the moment of its activation

it is easy to define new user profiles

(16)

D B

M G

29

Roles in SQL-3

Definition of a role

CREATE ROLE RoleName

Definition of role privileges and user roles instruction GRANT

A user can have different roles at different times dynamic association of a role with a user

SET ROLE RoleName

Riferimenti

Documenti correlati

Indeed, according to the proposed access control model, a user is authorized to evaluate an aggregate operation on a stream if: (i) he/she has a read privilege over the stream, or

The database is in a new (final) correct state The changes to the data executed by the transaction

if Rossi has propagated the privilege to other users, the privilege is revoked in cascade if Rossi has created a view using the SELECT privilege, the view is removed. REVOKE

Returns the array corresponding to the current row, or FALSE in case there are no rows available Each column of the result is stored in an element of the array, starting from

Trigger to manage reorder in an inventory stock when the stocked quantity of a product goes below a given threshold. a new order for the product should be

P (CodP, NomeP, Taglia, Colore, Magazzino) F (CodF, NomeF, NSoci, Sede).. FP (CodF,

Per le autovetture per cui sono state necessarie riparazioni effettuate da almeno 3 meccanici diversi nello stesso giorno, visualizzare la targa dell’autovettura, la data

Per le autovetture per cui sono state necessarie riparazioni effettuate da almeno 3 meccanici diversi nello stesso giorno, visualizzare la targa dell’autovettura, la data