UNIT 3- DATABASE INTEGRITY AND SECURITY CONCEPTS (1).pdf
1. Unit 3
Database Integrity and Security Concepts
By Kavita Shinde
Asst. Professor
Computer Science
MITACSC, Alandi Pune.
2. Content:
3.1 Domain constraints
3.2 Referential Integrity
3.3 Introduction to database security concepts
3.4 Methods for database security
3.4.1Discretionary access control method
3.4.2Mandatory access control
3.4.3. Role base access control for multilevel security.
3.5 Use of views in security enforcement.
3.6 Overview of encryption technique for security.
3.7 Statistical database security.
3. 3.1 Domain constraints
-Are most elementary form of integrity constraint.
-Every domain must contain atomic values.
-It makes sure that the data value entered for that particular column matches with the data type
defined for that column.
4. 3.2 Referential Integrity:
-Also known as foreign key constraint.
-A foreign key is a key whose values are derived from the Primary key of another table.
-The table containing the foreign key is called the child table.
-The table containing the Primary key/candidate key is called the referenced or parent table.
-Rules :
-A record cannot be deleted from a primary table if matching records exist in a related table.
-A primary key value cannot be changed in the primary table if that record has related records.
-A value cannot be entered in the foreign key field of the related table that doesn't exist in the
primary key of the primary table.
-A Null value can be entered in the foreign key, specifying that the records are unrelated.
Insert Constraint:
Value cannot be inserted in CHILD Table if the value is not lying in MASTER Table
Delete Constraint:
Value cannot be deleted from MASTER Table if the value is lying in CHILD Table
6. 3.3 Introduction to database security concepts:
Threats to Databases:
Threats to databases can result in the loss or degradation of some or all of the following commonly
accepted security goals: integrity, availability, and confidentiality.
(1)Loss of integrity:
-Database integrity refers to the requirement that information be protected from improper
modification.
-Integrity is lost if unauthorized changes are made to the data by either intentional or accidental
acts.
(2)Loss of availability:
Refers to making objects available to a human user or a program to which they have a legitimate
right.
(3)Loss of confidentiality:
Refers to the protection of data from unauthorized disclosure.
7. 3.3 Introduction to database security concepts:
-Database Security:
-Keep sensitive information safe and prevent the loss of data.
-Security of data base is controlled by Database Administrator (DBA).
-The following are the main control measures are used to provide security of data in databases:
1. Authentication
2. Access control
3. Inference control
4. Flow control
5. Database Security applying Statistical Method
6. Encryption
8. 1.Authentication : [Login Process]
-Used to protect database against unauthorized access.
-A user can gain access to the database after clearing the login process through
only valid user accounts.
-Each user account is password protected.
2.Access control : [User Accounts]
-The security mechanism of DBMS must include some provisions for restricting access
to the data base by unauthorized users.
-Access control is done by creating user accounts and to control login process by the
DBMS.
-Database access of sensitive data is possible only to those people (database
users) who are allowed to access such data and to restrict access to unauthorized
persons.
3.Inference control :
-This method protect the sensitive information from indirect disclosure.
9. 4.Flow control :
-Distributed systems encompass a lot of data flow from one site to another and also
within a site.
-Flow control prevents data from being transferred in such a way that it can be
accessed by unauthorized agents.
5.Database Security applying Statistical Method :
-Statistical database security focuses on the protection of confidential individual
values stored in and used for statistical purposes and used to retrieve the summaries
of values based on categories.
-They do not permit to retrieve the individual information.
6.Encryption:
-Data encryption refers to coding data when sensitive data is to be communicated
over public channels.
-Even if an unauthorized agent gains access of the data, he cannot understand it
since it is in an incomprehensible format.
10. 3.3 Introduction to database security concepts:
Database Security and the DBA
-The DBA is responsible for the overall security of the database system.
-The DBA’s responsibilities include granting and revoking privileges to users.
Account creation:
This action creates a new account and password for a user or a group of users to
enable access to the DBMS.
Privilege granting:
This action permits the DBA to grant certain privileges to certain accounts.
Privilege revocation:
This action permits the DBA to revoke (cancel) certain privileges that were
previously given to certain accounts.
Security level assignment:
This action consists of assigning user accounts to the appropriate security clearance
level.
11. Ex:
(1)GRANT Command:
GRANT privilege [, ...]
ON object [, ...]
TO { PUBLIC | GROUP group | username }
privilege :
values could be: SELECT, INSERT, UPDATE, DELETE, ALL,etc.
object :
The name of an object to which to grant access (table, view, sequence)
PUBLIC:
To all users.
GROUP group :
A group to whom to grant privileges.
Username:
The name of a user to whom to grant privileges. PUBLIC is a short form representing all users.
12. Ex:
(1)Revoke Command:
REVOKE privilege [, ...]
ON object [, ...]
FROM { PUBLIC | GROUP groupname | username }
privilege :
values could be: SELECT, INSERT, UPDATE, DELETE, RULE, ALL.
object :
The name of an object to which to grant access. The possible objects are: table, view, sequence
PUBLIC:
A short form representing all users.
GROUP group :
A group to whom to grant privileges.
Username:
The name of a user to whom to grant privileges. PUBLIC is a short form representing all users.
13. Ex:
(1)testdb=# CREATE USER manisha WITH PASSWORD 'password';
CREATE ROLE
(2)testdb=# GRANT ALL ON COMPANY TO manisha;
GRANT
(3)testdb=# REVOKE ALL ON COMPANY FROM manisha;
REVOKE
(4)testdb=# DROP USER manisha;
DROP ROLE
14. 3.4 Methods for database security:
-Regulates which users, applications, and devices can view, edit, add, and delete
resources in an organization’s environment.
-Controlling access is one of the key practices to protect sensitive data from theft,
misuse, abuse, and any other threats.
15. 3.4.1 Discretionary access control : (identity-based access control model )
-Provides users a certain amount of control over their data.
-Data owners (or any users authorized to control data) can define access permissions for specific users
or groups of users.
-DAC is quite a popular model because it allows a lot of freedom for users and doesn’t cause
administrative overhead.
-User 1 can’t grant access rights that exceed their own.
For example, if user 1 can only read a document, they can’t allow user 2 to edit it.
16. 3.4.2 Mandatory access control:
-MAC is considered the most secure of all access control models.
-Access rules are manually defined by system administrators and strictly enforced
by the operating system or security kernel.
-Regular users can’t alter security attributes even for data they’ve created.
17. 3.4.3 Role-based access control:
-Also known as Non discretionary Access Control, takes more of a real world approach to
structuring access control.
-Access under RBAC is based on a user's job function within the organization to which the
computer system belongs.
-Essentially, RBAC assigns permissions to particular roles in an organization. Users are then
assigned to that particular role.
-For example, an accountant in a company will be assigned to the Accountant role, gaining access
to all the resources permitted for all accountants on the system. Similarly, a software engineer might
be assigned to the developer role.
Roles differ from groups in that while users may belong to multiple groups, a user under RBAC
may only be assigned a single role in an organization. Additionally, there is no way to provide
individual users additional permissions over and above those available for their role. The accountant
described above gets the same permissions as all other accountants, nothing more and nothing less.
18. 3.5 Use of views in security enforcement:
Rather than granting users privileges on a particular table, you can give them access to a view of the
table.
Views add two more levels of security:
-A view can limit access to only selected columns of the base table.
-A view can provide value-based security for the information in a table. Thus a WHERE clause in
the definition of a view can display only selected rows of a base table.
-Types of views :
Read-only View : Allows only SELECT operations.
Updateable View : Allows SELECT as well as INSERT , UPDATE and DELETE operations.
19. -Syn:
(1) Read Only View:
CREATE <OR REPLACE> VIEW <ViewName> AS SELECT <ColumnName1 >, <ColumnName2>
FROM <TableName> WHERE <ColumnName> = < Expression List> <WITH READ ONLY> ;
-Ex:
create view stu as select enroll,name from student;
(2) Updateable View:
update stu set name='xyz' where enroll=4866;
drop view stu;
-Dropping View:
drop view stu;
20. 3.6 Overview of encryption technique for security:
-Encryption is a security method in which information is encoded in such a way that only
authorized user can read it.
-It uses encryption algorithm to generate cipher text that can only be read if decrypted.
Types of Encryption
There are two types of encryptions schemes as listed below:
Symmetric Key encryption
Public Key encryption
21. (1)Symmetric Key encryption:
Symmetric key encryption algorithmuses same cryptographic keys for both encryption and
decryption of cipher text.
Ex: DES(Data Encryption Standard)
(2)Public Key encryption:
Public key encryption algorithm uses pair of keys, one of which is a secret key and
one of which is public. These two keys are mathematically linked with each other.
Ex: RSA (Rivest, Shamir, and Adheman) algorithm and Diffie– Hellman algorithm.
22. 3.7 Statistical database security:
-A statistical database (SDB) is one that provides data of a statistical nature, such
as counts and averages.
-The term statistical database is used in two contexts:
Pure statistical database:
-This type of database only stores statistical data.
-An example is a census database.
-Access control for a pure SDB is straightforward.
-Certain users are authorized to access the entire database.
Ordinary database with statistical access:
-This type of database contains individual entries.
-The database supports a population of nonstatistical users who are allowed access
to selected portions of the database using DAC, RBAC, or MAC.
-In addition, the database supports a set of statistical users who are only permitted
statistical queries.