Data Redactionの記事にて行った伏字処理を、TSDPにて構成してみます。データベース・アクションにユーザーADMINにて接続し、構成します。
保護するデータの種類を定義します。伏字処理の対象は表HR.EMPの列SALですが、この列の機密タイプをsalary_typeと定義し、伏字処理はこのsalary_typeに対して構成します。
プロシージャDBMS_TSDP_MANAGE.ADD_SENSITIVE_TYPEを呼び出します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN | |
DBMS_TSDP_MANAGE.ADD_SENSITIVE_TYPE( | |
sensitive_type => 'salary_type' | |
, user_comment => 'Type for salary columns using a number data type'); | |
END; | |
/ |
作成された機密タイプはビューDBA_SENSITIVE_COLUMN_TYPESより確認できます。
作成した機密タイプに表HR.EMPの列SALを登録します。プロシージャDBMS_TSDP_MANAGE.ADD_SENSITIVE_COLUMNを呼び出します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN | |
DBMS_TSDP_MANAGE.ADD_SENSITIVE_COLUMN( | |
schema_name => 'HR' | |
, table_name => 'EMP' | |
, column_name => 'SAL' | |
, sensitive_type => 'salary_type' | |
, user_comment => 'Sensitive column addition of salary_type' | |
); | |
END; | |
/ |
TSDPのポリシーとしてredact_salを作成します。プロシージャDBMS_TSDP_PROTECT.ADD_POLICYを呼び出します。
Data Redactionの設定と同様に、function_typeとしてDBMS_REDACT.PARTIAL、function_parametersとして9,1,3、expressionに1=1を指定しています。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
redact_feature_options DBMS_TSDP_PROTECT.FEATURE_OPTIONS; | |
policy_conditions DBMS_TSDP_PROTECT.POLICY_CONDITIONS; | |
BEGIN | |
redact_feature_options ('expression') := '1=1'; | |
redact_feature_options ('function_type') := 'DBMS_REDACT.PARTIAL'; | |
redact_feature_options ('function_parameters') := '9,1,3'; | |
policy_conditions(DBMS_TSDP_PROTECT.DATATYPE) := 'NUMBER'; | |
policy_conditions(DBMS_TSDP_PROTECT.LENGTH) := '16'; | |
DBMS_TSDP_PROTECT.ADD_POLICY ( | |
'redact_sal' | |
, DBMS_TSDP_PROTECT.REDACT | |
, redact_feature_options | |
, policy_conditions | |
); | |
END; | |
/ |
作成したポリシーについては、ビューDBA_TSDP_POLICY_CONDITION、DBA_TSDP_POLICY_FEATURE、DBA_TSDP_POLICY_PARAMETERより確認できます。
作成した機密タイプsalary_typeとポリシーredact_salを関連付けます。プロシージャDBMS_TSDP_PROTECT.ASSOCIATE_POLICYを呼び出します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN | |
DBMS_TSDP_PROTECT.ASSOCIATE_POLICY( | |
policy_name => 'redact_sal' | |
, sensitive_type => 'salary_type' | |
, associate => true | |
); | |
END; | |
/ |
機密タイプsalary_typeに登録されている全ての列について、ポリシーに従った(この場合Data Redactionによる伏字処理)保護を有効にします。プロシージャDBMS_TSDP_PROTECT.ENABLE_PROTECTION_TYPEを呼び出します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN | |
DBMS_TSDP_PROTECT.ENABLE_PROTECTION_TYPE( | |
sensitive_type => 'salary_type' | |
); | |
END; | |
/ |
以上で透過的機密データ保護によるData Redactionの設定が完了しました。
設定内容はビューDBA_TSDP_POLICY_PROTECTIONより確認できます。
テスト用のAPEXアプリケーションを実行します。
従業員名に以下を入力し、TSDPによる伏字処理を確認します。
SCOTT' or '1' = '1
列Salに伏字処理が適用されていることが確認できます。
TSDPの無効化を行います。プロシージャDBMS_TSDP_PROTECT.DISABLE_PROTECTION_TYPEを呼び出します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN | |
DBMS_TSDP_PROTECT.DISABLE_PROTECTION_TYPE( | |
sensitive_type => 'salary_type' | |
); | |
END; | |
/ |
TSDPのポリシーを削除します。プロシージャDBMS_TSDP_PROTECT.DROP_POLICYを呼び出します。
機密タイプから列の登録を削除には、プロシージャDBMS_TSDP_MANAGE.DROP_SENSITIVE_COLUMN、機密タイプの削除にはDBMS_TSDP_MANAGE.DROP_SENSITIVE_TYPEを呼び出します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN | |
DBMS_TSDP_MANAGE.DROP_SENSITIVE_COLUMN( | |
schema_name => 'HR' | |
, table_name => 'EMP' | |
, column_name => 'SAL' | |
); | |
DBMS_TSDP_MANAGE.DROP_SENSITIVE_TYPE( | |
sensitive_type => 'salary_type' | |
); | |
DBMS_TSDP_PROTECT.DROP_POLICY( | |
policy_name => 'redact_sal' | |
); | |
END; | |
/ |
Data Redactionの他に、仮想プライベート・データベース、統合監査、ファイングレイン監査のポリシーについても透過的機密データ保護(TSDP)ポリシーを使用することができます。
透過的機密データ保護はアプリケーション・データ・モデルを作成して機密列をリストアップする機能など、オラクルの管理ツールであるOracle Enterprise Managerの利用を前提としている部分があります。Enterprise Managerを使用しない場合は、列の一括操作などができないため、機能ごとにポリシーを設定しても大きな違いはないと感じます。