 | Oracle Label Security |
Protect PII from unauthorized access
The VPD policy will do the following:
- Get the numerical label tag from the user's current label
- Get the numerical label tag from the 'S:PII' label
- User label ≥ 'S:PII' → access to all rows in sensitive columns
- User label < 'S:PII' → access to all rows, but sensitive PII column is blank
In this example, the VPD policy will be applied to the hr.EMPLOYEES table:
BEGIN
DBMS_RLS.ADD_POLICY(
object_schema => 'HR',
object_name => 'EMPLOYEES',
policy_name => 'vpd_protect_pii',
function_schema => 'LBACSYS',
policy_function => 'f_protect_pii',
statement_types => 'select',
sec_relevant_cols => 'SALARY',
sec_relevant_cols_opt => dbms_rls.ALL_ROWS,
policy_type => dbms_rls.CONTEXT_SENSITIVE);
END;
/
Download the entire demo script from here.