Oracle 12c - Data Redaction
Env:
Virtualbox + Oracle Linux 64bit 6.4 + Oracle database 12.1
Introduction:
A new security feature is intorudced in 12c, one of top-10 favourite new features of Tom Kyte. It's also known as data masking. Data redaction hides sensitive data from low-privileged users. For example, your credit card number, date of birth should be masked in a CRM application.
Data redaction takes places on the fly, it does not change the data in the database.Data redaction does not apply to users with "EXEMPT REDACTION POLICY". SYSDBA and DBA are not affected by data redaction.
Adding a new redaction policy:
begin
dbms_redact.add_policy(object_schema => 'HR',
object_name => 'EMPLOYEES',
column_name => 'SALARY',
policy_name => 'SALARY_REDACTION',
function_type => dbms_redact.FULL,
expression => 'SYS_CONTEXT(''USERENV'',''SESSION_USER'') != ''HR'' OR SYS_CONTEXT(''USERENV'',''SESSION_USER'') IS NULL'
);
end;
dbms_redact.add_policy(object_schema => 'HR',
object_name => 'EMPLOYEES',
column_name => 'SALARY',
policy_name => 'SALARY_REDACTION',
function_type => dbms_redact.FULL,
expression => 'SYS_CONTEXT(''USERENV'',''SESSION_USER'') != ''HR'' OR SYS_CONTEXT(''USERENV'',''SESSION_USER'') IS NULL'
);
end;
User needs execute privilege on dbms_redact. Even if the user is the owner of the object. Say, user hr wanted to add a redaction policy to table employees, hiding column salary. But he's not allowed to do so until he gets select privilege on dbms_redact. See the error as follows:
ORA-06550: line 6, column 43:
PLS-00201: identifier 'DBMS_REDACT' must be declared
PLS-00201: identifier 'DBMS_REDACT' must be declared
SQL> connect sys/123456@pdborcl as sysdba;
Connected.
SQL> show user;
USER is "SYS"
SQL> grant execute on dbms_redact to hr;
Connected.
SQL> show user;
USER is "SYS"
SQL> grant execute on dbms_redact to hr;
Grant succeeded.
Execute the add_policy again, you're all set.
Observing policies in the database:
select * from redaction_policies;
Examine the data redaction:
Login as nobody who has select privilege on hr.employees.
SQL> select first_name, last_name, salary from hr.employees where rownum <= 3;
FIRST_NAME LAST_NAME SALARY
-------------------- ------------------------- ----------
Steven King 0
Neena Kochhar 0
Lex De Haan 0
-------------------- ------------------------- ----------
Steven King 0
Neena Kochhar 0
Lex De Haan 0
Drop the redaction policy:
EXEC DBMS_REDACT.DROP_POLICY('HR','EMPLOYEES','SALARY_REDACTION');
Changing the display format:
begin
dbms_redact.alter_policy(object_schema => 'HR',
object_name => 'EMPLOYEES',
policy_name => 'SALARY_REDACTION',
action => dbms_redact.MODIFY_COLUMN,
column_name => 'SALARY',
function_type => dbms_redact.partial,
function_parameters => '9,1,8'
);
end;
dbms_redact.alter_policy(object_schema => 'HR',
object_name => 'EMPLOYEES',
policy_name => 'SALARY_REDACTION',
action => dbms_redact.MODIFY_COLUMN,
column_name => 'SALARY',
function_type => dbms_redact.partial,
function_parameters => '9,1,8'
);
end;
SQL> select first_name, last_name, salary from hr.employees where rownum <= 3;
FIRST_NAME LAST_NAME SALARY
-------------------- ------------------------- ----------
Steven King 99999
Neena Kochhar 99999
Lex De Haan 99999
-------------------- ------------------------- ----------
Steven King 99999
Neena Kochhar 99999
Lex De Haan 99999
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/638844/viewspace-768583/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle Data Redaction資料加密Oracle加密
- Oracle Data Redaction實驗記錄Oracle
- [20181018]Oracle Database 12c: Data Redaction.txtOracleDatabase
- Oracle 12c Data Guard搭建(一)Oracle
- Oracle Data Guard 12c 新功能Oracle
- Oracle 12c 新特性 Active Data Guard Far SyncOracle
- Oracle 12c新特性 - Active Data Guard功能增強Oracle
- Oracle資料庫12c最新安全工具Data RedactionFPOracle資料庫
- Oracle 12c新特性 - Data Pump (expdp/impdp) 功能增強Oracle
- Oracle goldengate 12c 新特性之完美支援Active Data GuardOracleGo
- Oracle 12c Data guard 物理備庫應急切換(failover)流程OracleAI
- Oracle 12c Data guard 物理主備庫正常切換(switchover)流程Oracle
- 搭建邏輯Data Guard 12c
- Oracle 12C 新特性之擴充套件資料型別(extended data type)Oracle套件資料型別
- Oracle 12cOracle
- oracle 12c Deprecation of Oracle StreamsOracle
- Oracle Data BufferOracle
- oracle data guard!!Oracle
- oracle data pumpOracle
- Oracle 12C GDSOracle
- 【12c Partitioning】Oracle 12c Partitioning特性Oracle
- Oracle 12C安裝Oracle
- Oracle 12c新特性Oracle
- Oracle 12c Relocate PDBOracle
- Oracle 12c Refreshable CloneOracle
- Oracle 12c RAC: MGMTDBOracle
- ORACLE 12C EM ExpressOracleExpress
- Oracle 12C配置EMOracle
- ORACLE 12c Core DocOracle
- oracle 12c 釋出Oracle
- Oracle Flashback Data ArchiveOracleHive
- Oracle Data Guard配置Oracle
- Oracle 12c升級指南Oracle
- 12C Oracle ASM Filter DriverOracleASMFilter
- Oracle 12c Automatic ReoptimizationOracle
- benchmark 壓測Oracle 12cOracle
- sysbench壓測Oracle 12COracle
- Oracle 12c 新特性(四)Oracle