Download presentation
Presentation is loading. Please wait.
Published byCamron Preston Modified over 9 years ago
1
SCUHolliday12–1 Schedule Today: u Security, Object-Relational Systems. u Read Section 8.7. Next u Indexing. u Read Section 6.6.5 And Then u Query optimization. u No Readings in Text
2
SCUHolliday12–2 Terminology A Vulnerability is a weakness in the system that might (or might not) be exploited to cause loss or harm. Threats to computing systems are circumstances that have the potential to cause loss or harm. Human attacks from disgruntled employees, natural disasters, human errors, hardware and software flaws are threats. Threats can be assigned a probability.
3
SCUHolliday12–3 Security Goals Identify the assets: hardware, software, data Maintain three properties: u Confidentiality – only authorized people can see protected data u Integrity – only acceptable and authorized modifications, internally consistent and meaningful, error detection and correction u Availability – fair allocation of resources, can be used as intended
4
SCUHolliday12–4 Security Vulnerabilities Database system level u Authentication and authorization mechanisms to allow specific users access only to required data u DBMS has automatic backup and recovery mechanism u Audit files Operating system level u O.S. super-users can do anything they want to the database! O.S. level security is required. Network level: must use encryption to prevent u Eavesdropping (unauthorized reading of messages) u Masquerading (pretending to be an authorized user or sending messages supposedly from authorized users)
5
SCUHolliday12–5 Sources of Vulnerabilities u Physical level Physical access to computers allows destruction of data by intruders; traditional lock-and-key security is needed Computers must also be protected from floods, fire, etc. u Human level Users must be screened to ensure that authorized users do not give access to intruders Users should be trained on password selection and secrecy
6
SCUHolliday12–6 Authorization in SQL File systems identify certain access privileges on files, e.g., read, write, execute. Similarly, SQL identifies six access privileges on relations, of which the most important are: 1. SELECT = the right to query the relation. ( READ ) 2. INSERT = the right to insert tuples into the relation – may refer to one attribute, in which case the privilege is to specify only one column of the inserted tuple. 3. DELETE = the right to delete tuples from the relation. 4. UPDATE = the right to update tuples of the relation – may refer to one attribute.
7
SCUHolliday12–7 Granting Privileges You have all possible privileges to the relations you create. You may grant privileges to any user if you have those privileges “with grant option.” u You have this option to your own relations. Example 1.Here, Sally can query Sells and can change prices, but cannot pass on this power: GRANT SELECT ON Sells, UPDATE(price) ON Sells TO sally; 2.Here, Sally can also pass these privileges to whom she chooses: GRANT SELECT ON Sells, UPDATE(price) ON Sells TO sally WITH GRANT OPTION;
8
SCUHolliday12–8 Revoking Privileges Your privileges can be revoked. Syntax is like granting, but REVOKE... FROM instead of GRANT... TO. Determining whether or not you have a privilege is tricky, involving “grant diagrams”. However, the basic principles are: a)If you have been given a privilege by several different people, then all of them have to revoke in order for you to lose the privilege. b)Revocation is transitive. if A granted P to B, who then granted P to C, and then A revokes P from B, it is as if B also revoked P from C.
9
SCUHolliday12–9 Schema Privileges Forms of authorization to modify the database schema: Index authorization - allows creation and deletion of indices. Resources authorization - allows creation of new relations. Alteration authorization - allows addition or deletion of attributes in a relation. Drop authorization - allows deletion of relations.
10
SCUHolliday12–10 View Privileges Users can be given authorization on views, without being given any authorization on the relations used in the view definition Ability of views to hide data serves both to simplify usage of the system and to enhance security by allowing users access only to data they need for their job A combination of relation-level security and view-level security can be used to limit a user’s access to precisely the data that user needs.
11
SCUHolliday12–11 Views Suppose a bank clerk needs to know the names of the customers of each branch, but is not authorized to see specific loan information. u Approach: Deny direct access to the loan relation, but grant access to the view cust-loan, which consists only of the names of customers and the branches at which they have a loan. u The cust-loan view is defined in SQL as follows: create view cust-loan as select branchname, customer-name from borrower, loan where borrower.loan-number = loan.loan- number
12
SCUHolliday12–12 The clerk is authorized to see the result of the query: select * from cust-loan When the query processor translates the result into a query on the actual relations in the database, we obtain a query on borrower and loan. Authorization must be checked on the clerk’s query before query processing begins. (Can you guess why?)
13
SCUHolliday12–13 Creation of view does not require resources authorization since no real relation is being created. The creator of a view gets only those privileges that provide no additional authorization beyond that he already had. E.g. if creator of view cust-loan had only read authorization on borrower and loan, he gets only read authorization on cust-loan
14
SCUHolliday12–14 The passage of authorization from one user to another may be represented by an authorization graph. The nodes of this graph are the users. The root of the graph is the database administrator. Consider graph for update authorization on loan. An edge U i U j indicates that user U i has granted update authorization on loan to U j. U1U1 U4U4 U2U2 U5U5 U3U3 DBA
15
SCUHolliday12–15 Requirement: All edges in an authorization graph must be part of some path originating with the database administrator If DBA revokes grant from U 1 : u Grant must be revoked from U 4 since U 1 no longer has authorization u Grant must not be revoked from U 5 since U 5 has another authorization path from DBA through U 2 Must prevent cycles of grants with no path from the root: u DBA grants authorization to U 7 u U7 grants authorization to U 8 u U8 grants authorization to U 7 u DBA revokes authorization from U 7 Must revoke grant U 7 to U 8 and from U 8 to U 7 since there is no path from DBA to U 7 or to U 8 anymore.
16
SCUHolliday12–16 Another Look at GRANT The grant statement is used to confer authorization grant on to is: u a user-id u public, which allows all valid users the privilege granted u A role (more on this later) Granting a privilege on a view does not imply granting any privileges on the underlying relations. The grantor of the privilege must already hold the privilege on the specified item (or be the database administrator).
17
SCUHolliday12–17 The GRANT Statement select: allows read access to relation,or the ability to query using the view u Example: grant users U 1, U 2, and U 3 select authorization on the branch relation: grant select on branch to U 1, U 2, U 3 insert: the ability to insert tuples update: the ability to update using the SQL update statement delete: the ability to delete tuples. references: ability to declare foreign keys when creating relations. usage: In SQL-92; authorizes a user to use a specified domain all privileges: used as a short form for all the allowable privileges
18
SCUHolliday12–18 More on GRANT with grant option: allows a user who is granted a privilege to pass the privilege on to other users. u Example: grant select on branch to U 1 with grant option gives U 1 the select privileges on branch and allows U 1 to grant this privilege to others
19
SCUHolliday12–19 Roles Roles permit common privileges for a class of users which can be specified just once by creating a corresponding “role” Privileges can be granted to or revoked from roles, just like to/from users Roles can be assigned to users, and even to other roles SQL:1999 supports roles create role teller create role manager grant select on branch to teller grant update (balance) on account to teller grant all privileges on account to manager grant teller to manager grant teller to alice, bob grant manager to JoAnne
20
SCUHolliday12–20 More on REVOKE The revoke statement is used to revoke authorization. revoke on from [restrict|cascade] Example: revoke select on branch from U 1, U 2, U 3 cascade Revocation of a privilege from a user may cause other users also to lose that privilege; referred to as cascading of the revoke. We can prevent cascading by specifying restrict: revoke select on branch from U 1, U 2, U 3 restrict With restrict, the revoke command fails if cascading revokes are required.
21
SCUHolliday12–21 Revoking Continued may be all to revoke all privileges the revokee may hold. If includes public all users lose the privilege except those granted it explicitly. If the same privilege was granted twice to the same user by different grantees, the user may retain the privilege after the revocation. All privileges that depend on the privilege being revoked are also revoked.
22
SCUHolliday12–22 Limitations SQL does not support authorization at a tuple level u E.g. we cannot restrict students to see only (the tuples storing) their own grades (but Oracle 9i does) All end-users of an application (such as a web application) may be mapped to a single database user The task of authorization in above cases falls on the application program, with no support from SQL u Authorization must be done in application code, and may be dispersed all over an application u Checking for absence of authorization loopholes becomes very difficult since it requires reading large amounts of application code
23
SCUHolliday12–23 Encryption Data may be encrypted when database authorization provisions do not offer sufficient protection. Properties of good encryption technique: u Relatively simple for authorized users to encrypt and decrypt data. u Encryption scheme depends not on the secrecy of the algorithm but on the secrecy of a parameter of the algorithm called the encryption key. u Extremely difficult for an intruder to determine the encryption key. (AMTH 387 Cryptology – 4 units)
24
SCUHolliday12–24 Encryption Continued Data Encryption Standard (DES) substitutes characters and rearranges their order on the basis of an encryption key. Scheme is no more secure than the key transmission mechanism since the key has to be shared. Advanced Encryption Standard (AES) is a new standard replacing DES, and is based on the Rijndael algorithm, but is also dependent on shared secret keys Public-key encryption is based on each user having two keys: u public key – publicly published key used to encrypt data, but cannot be used to decrypt that data u private key -- key known only to individual user, and used to decrypt data. Need not be transmitted to the site doing encryption. Encryption scheme is such that it is impossible or extremely hard to decrypt data given only the public key. The RSA public-key encryption scheme is based on the difficulty of factoring a very large number (100's of digits) into its prime components.
25
SCUHolliday12–25 Authentication Password based authentication is widely used, but is susceptible to sniffing on a network – do you use telnet ?? Challenge-response systems avoid transmission of passwords u DB sends a (randomly generated) challenge string to user u User encrypts string and returns result. u DB verifies identity by decrypting result u Can use public-key encryption system by DB sending a message encrypted using user’s public key, and user decrypting and sending the message back Digital signatures are used to verify authenticity of data u E.g. use private key (in reverse) to encrypt data, and anyone can verify authenticity by using public key (in reverse) to decrypt data. Only holder of private key could have created the encrypted data. u Digital signatures also help ensure nonrepudiation: sender cannot later claim to have not created the data
26
SCUHolliday12–26 Statistical Databases Problem: how to ensure privacy of individuals while allowing use of data for statistical purposes (e.g., finding median income, average bank balance etc.) How to allow: Select avg(balance) From Account Where branch-name=“Oakland” Without allowing Select balance From Account Where acc#=101
27
SCUHolliday12–27 Statistical Databases Solutions: u System rejects any query that involves fewer than some predetermined number of individuals. Still possible to use results of multiple overlapping queries to deduce data about an individual u Data pollution -- random falsification of data provided in response to a query. u Random modification of the query itself. There is a tradeoff between accuracy and security.
28
SCUHolliday12–28 Physical Level Security Protection of equipment from floods, power failure, etc. Protection of disks from theft, erasure, physical damage. Protection of network and terminal cables from wiretaps non-invasive electronic eavesdropping, physical damage. Solutions: Replicated hardware: u mirrored disks, dual busses, etc. u multiple access paths between every pair of devices Physical security: locks, police, etc. Software techniques to detect physical security breaches.
29
SCUHolliday12–29 Human Level Security Protection from stolen passwords, sabotage, etc. Primarily a management problem: u Frequent change of passwords u Use of “non-guessable” passwords u Log all invalid access attempts u Data audits u Careful hiring practices
30
SCUHolliday12–30 Operating System Level Protection from invalid logins File-level access protection (often not very helpful for database security) Protection from improper use of “superuser” authority. Protection from improper use of privileged machine instructions.
31
SCUHolliday12–31 Network Level Security Each site must ensure that it communicate with trusted sites (not intruders). Links must be protected from theft or modification of messages Mechanisms: u Identification protocol (password-based), u Cryptography.
32
SCUHolliday12–32 Database Level Security Assume security at network, operating system, human, and physical levels. Database specific issues: u each user may have authority to read only part of the data and to write only part of the data. u User authority may correspond to entire files or relations, but it may also correspond only to parts of files or relations. Oracle 9i allows row-level authorization
33
SCUHolliday12–33 Object-Relational DBMS Get the advantages of Object Orientation without losing the advantages of Relational DBMS.
34
SCUHolliday12–34 Object-Relational Systems Keep relation as the fundamental abstraction. Compare with “object-oriented DBMS,” which uses the class as the fundamental abstraction and tacks on relations as one of many types. Motivations Allow DBMS’s to deal with specialized types – maps, signals, images, etc. – with their own specialized methods as in O-O programming languages. Supports specialized methods even on conventional relational data. Supports structure more complex than “flat files.”
35
SCUHolliday12–35 User-Defined Types SQL allows UDT’s that play a dual role: 1.They can be the types of relations; i.e., the type of their tuple. u Sometimes called a row type. 2.They can be the type of an attribute in a relation.
36
SCUHolliday12–36 Defining UDT’s – Example in Oracle Syntax CREATE TYPE BarType AS OBJECT ( name CHAR(20) UNIQUE, addr CHAR(20) ); CREATE TYPE BeerType AS OBJECT ( name CHAR(20) UNIQUE, manf CHAR(20) ); CREATE TYPE MenuType AS OBJECT ( bar REF BarType, beer REF BeerType, price FLOAT );
37
SCUHolliday12–37 Creating Tables Type declarations do not create tables. They are used in place of element lists in CREATE TABLE statements. Example CREATE TABLE Bars OF BarType; CREATE TABLE Beers OF BeerType; CREATE TABLE Sells OF MenuType;
38
SCUHolliday12–38 Values of User-Defined Types – Oracle Approach Each UDT has a type constructor of the same name. Values of that type are the values of its fields wrapped in the constructor. Example SELECT * FROM Bars; produces values such as BarType('Joe''s Bar','Maple St.')
39
SCUHolliday12–39 Accessing Fields of an Object – Oracle Approach The dot operator works as expected. Thus, if we want the bar name and address without the constructor: SELECT bb.name, bb.addr FROM Bars bb; The alias bb is not technically necessary, but there are other places where we must use an alias in order to access objects, and it is a good habit to use an alias always.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.