4670 Lecture8 VPD
4670 Lecture8 VPD
Auditing: Protecting
Data Integrity and
Accessibility
Chapter 6
Virtual Private
Databases
Objectives
• Define the term “virtual private
database” and explain its importance
• Implement a virtual private database
by using the VIEW database object
• Implement a virtual private database
by using Oracle’s application context
• Implement row-level and column-
level security
on T.
– Suppose we want to restrict access to some
information in T.
– Without VPD, all view definitions have to be changed.
– Using VPD, it can be done by attaching a policy
function to
T; as the policy is enforced in T, the policy is also
enforced for all the views that are based on T.
Database Security & Auditing: Protecting Data Integrity & 4
Accessibility
Overview of Virtual
Private
• A VPD deals withDatabases
data access
• VPD controls data access at the row or column
level
• Oracle10/11g:
– Fine-grained access control: associate security
policies to database objects
– Application Context: define and access
application or session attributes
– Combining these two features, VPD enables
administrators to define and enforce row-level
access control policies based on session
attributes.
• Implementing Row- and Cell-Level Security in
Classified Databases Using SQL Server 2005
http://technet.microsoft.com/en-us/library/cc966395.aspx5
Database Security & Auditing: Protecting Data Integrity &
Accessibility
Overview of Virtual
Private Databases
(continued)
• Restrictions
– Applies only to ‘select’ statements
– The predicate must be a simple boolean expression.
e_id Name
1 Alice
2 Bob
3 Carl
e_id Name
1 Alice
2 Bob
3 Carl
Example:
DBMS_SESSION.SET_CONTEXT(‘USERENV’,
‘IP_ADDRESS’, “192.168.1.2”);
SYS_CONTEXT(‘USERENV’,
‘IP_ADDRESS’)
Returns 192.168.1.2
Database Security & Auditing: Protecting Data Integrity & 32
Accessibility
Implementing a VPD
Using Application Context
in Oracle
• Application context:
– Functionality specific to Oracle
– Allows to set database application
variables that can be retrieved by
database sessions
– Variables can be used for security
context- based or user-defined
environmental attributes
Security
USER Step 1 Step 2
Policy
Step 5
Step 4
Where Step 3
Predicate
if (SYS_CONTEXT(’emp_env’, ’job’) =
‘manager’) return ‘’;
else …
Database Security & Auditing: Protecting Data Integrity & 38
Accessibility
Multiple Policies
• It is possible to associate multiple policies to a database
object.
– The policies are enforced with AND syntax.
– For example, suppose table T is associated with {P1, P2,
P3}.
– When T is accessed by query Q = select A from T where
C.
– Q’ = select A from T where C (c1 c2 c3).