SlideShare a Scribd company logo
Data Redaction
Presented by:
Amul Sul
Principal Software Engineer, EDB
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.2
Welcome
• This webinar is being recorded.
• We will be sharing the slides and recording with you after the session.
• Please submit your questions via Zoom Q&A. All questions will be answered
at the end of the presentation.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.3
Agenda
Data Redaction
• Why & what Data Redaction ?
• What is EDB Data Redaction ?
• How to limit sensitive data exposure in EPAS ?
• Provision for the Oracle compatibility in EPAS ?
• Demo.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.4
Why & What Data Redaction ?
A technique that limits sensitive data exposure.
A GDPR (General Data Protection Regulation)-compliant implementation requires the use of many
technical capabilities, such as authentication, authorization, access control, virtual database, and
encryption.
One of the techniques often considered is data redaction to limits sensitive data exposure by
dynamically changing data as it is displayed for specific users.
Data redaction in EPAS version prior v11 and PostgreSQL -- See Creating a Data Redaction
Capability to Meet GDPR Requirements Using EDB Postgres blog, shows how we can use the
PostgreSQL search_path, user defined functions and views to add data redaction protection.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.5
What is EDB Data Redaction ?
Limits sensitive data exposure by dynamically changing data as it is displayed for specific users.
Data Policy Other User
Privileged User
Custom Data
Masking logic
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.6
What is EDB Data Redaction ?
Limits sensitive data exposure by dynamically changing data as it is displayed for specific users.
Policy
Name SSN
Sally Sample 020-78-9345
Jane Doe 123-33-9345
Emp Table Other
User
Privileged
User
Name SSN
Sally Sample xxx-xx-9345
Jane Doe xxx-xx-9345
Name SSN
Sally Sample 020-78-9345
Jane Doe 123-33-9345
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.7
How to limit sensitive data exposure in EPAS ?
Using Native Data Redaction Capability of EDB Postgres Advanced Server.
Redaction functionPolicy
Scope and exception options Policy expression
Redaction policies allow a user to
choose redaction behavior via
redaction function.
More than one redaction policy can
be created on the same table, but a
column can only be associated with
one policy.
Flexibility to choose when actual
redaction should apply and
exemptions on columns in the query
via the scope and exception options.
Boolean expression for the policy;
determines how the policy is to be
applied. The redaction occurs if this
policy expression is evaluated to TRUE.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.8
Policy
Create policy:
CREATE REDACTION POLICY name ON table_name
[ FOR ( expression ) ]
[ ADD column_name USING
redaction_function()
[ WITH OPTIONS ( redaction_options ) ] ]
[, … ];
Alter Policy:
ALTER REDACTION POLICY name ON table_name ...
➔Rename policy, enable or disable the policy
➔Change policy expression
➔Add more column or remove existing one
➔Change redaction_function and redaction_options
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.9
Policy
Create policy on emp table:
CREATE REDACTION POLICY emp_protect ON emp
ADD COLUMN ssn USING redact_ssn(ssn);
And the table description will be:
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.10
Redaction
function
CREATE FUNCTION redact_ssn (ssn varchar(11))
RETURNS varchar(11) AS
$$
SELECT overlay (ssn placing 'xxx-xx' from 1);
$$
LANGUAGE SQL;
Note : Return type of the redaction function should be same as the column type.
Policy
Other
User
Name SSN
Sally Sample xxx-xx-9345
Jane Doe xxx-xx-9345
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.11
Scope &
exception
options
Previously seen table description:
➢ SCOPE: Identified the query part where redaction to be applied
for the column.
○ Values: query, top_tlist, top_tlist_or_error.
➢ EXCEPTION: Identified the query part where redaction to be
exempted.
○ Values: none, equal, leakproof.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.12
Policy
expression
ALTER REDACTION POLICY emp_protect ON emp
FOR (SESSION_USER <> 'privileged_user');
OR
CREATE REDACTION POLICY emp_protect ON emp
FOR (SESSION_USER <> 'privileged_user')
ADD COLUMN ssn USING redact_ssn(ssn);
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.13
Oracle compatibility Provision in EPAS ?
DBMS_REDACT package
Redaction functionPolicy
Policy expression
Like Oracle, provides various
redaction type and supporting
functions.
DBMS_REDACT package provides
Oracle like procedure to add, alter,
enable, disable or drop the policy.
Same as the native support, the
redaction occurs if this policy
expression is evaluated to TRUE.
Scope and exception options
No provision, but user can use
native alter syntax to set scope and
exception.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.14
Policy
Create policy on emp table:
BEGIN
DBMS_REDACT.add_policy (
object_schema => 'public',
object_name => 'emp',
policy_name => 'emp_protect',
policy_description => 'policy for emp table ...',
column_name => 'ssn',
function_type => DBMS_REDACT.partial,
function_parameters => DBMS_REDACT.REDACT_US_SSN_F5,
expression => '1=1',
enable => true);
END;
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.15
Policy
Create policy on emp table:
BEGIN
DBMS_REDACT.add_policy (
object_schema => 'public',
object_name => 'emp',
policy_name => 'emp_protect',
policy_description => 'policy for emp table ...',
column_name => 'ssn',
function_type => DBMS_REDACT.partial,
function_parameters => DBMS_REDACT.REDACT_US_SSN_F5,
expression => '1=1',
enable => true);
END;
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.16
Function_type and Function_parameters:
BEGIN
DBMS_REDACT.add_policy (
object_schema => 'public',
object_name => 'emp',
policy_name => 'emp_protect',
policy_description => 'policy for emp table ...',
column_name => 'ssn',
function_type => DBMS_REDACT.partial,
function_parameters => DBMS_REDACT.REDACT_US_SSN_F5,
expression => '1=1',
enable => true);
END;
Redaction
function
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.17
Parameters: function_type
Redaction
function
NONE No redaction.
FULL Full redaction, redacts full values of the column data.
PARTIAL
Partial redaction, redacts a portion of the column data.
function_parameters needed.
RANDOM
Random redaction, each query results in a different random
value depending on the datatype of the column.
REGEXP
Regular Expression based redaction, searches for the
pattern of data to redact. regexp_pattern,
regexp_replace_string, regexp_position,
regexp_occurence, regexp_match_parameter
needed.
CUSTOM Custom redaction type.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.18
Parameters: function_parameters needed for PARTIAL type.
1. REDACT_US_SSN_F5
- Redacts the first 5 numbers of SSN.
- Example: The number 123-45-6789 becomes XXX-
XX-6789
1. REDACT_NA_PHONE_NUMBER
- Redacts the North American phone number by 0 leaving
the area code.
- Example: 1234567890 becomes 1230000000.
1. REDACT_DATE_MILLENNIUM
- Redacts a date that is in the DD-MM-YY format.
- Example: Redacts all date to 01-JAN-2000.
So on…
Partial redaction supports only Character, Number and Date types.
Redaction
function
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.19
Existing function_parameters constants not matching my
requirement, then?
Answer: No problem, you can use your function_parameters.
Here are the previously seen function_parameters constants for
Character, Number and Date type respectively and its internal
definition.
1. REDACT_US_SSN_F5 => 'VVVFVVFVVVV,VVV-VV-VVVV,X,1,5'
- input_fmt,output_fmt,mask_char,start,end
1. REDACT_NA_PHONE_NUMBER => '0,4,10'
- mask_digit,start,end
1. REDACT_DATE_MILLENNIUM => 'm1d1y2000'
- monthDigit,dayDigit,yearDigit
- You can replace hours, minutes and seconds too.
Redaction
function
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.20
Policy expression:
BEGIN
DBMS_REDACT.add_policy (
object_schema => 'public',
object_name => 'emp',
policy_name => 'emp_protect',
policy_description => 'policy for emp table ...',
column_name => 'ssn',
function_type => DBMS_REDACT.partial,
function_parameters => DBMS_REDACT.REDACT_US_SSN_F5,
expression => '1=1',
enable => true);
END;
Policy
expression
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.21
Alter
Policy
Action parameter of ALTER_POLICY() decides what
to alter:
1. Add column to the existing policy,
- action => ADD_COLUMN
1. Modify/Drop column redaction method,
- action => MODIFY_COLUMN
1. Modify policy expression,
- action => MODIFY_EXPRESSION
1. Set policy description, and
- action => SET_POLICY_DESCRIPTION
1. Set column description
- action => SET_COLUMN_DESCRIPTION
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.22
Alter
Policy
Alter policy to add another column:
BEGIN
DBMS_REDACT.alter_policy (
object_schema => 'public',
object_name => 'emp',
policy_name => 'emp_protect',
action =>
DBMS_REDACT.add_column,
column_name => 'salary',
function_type =>
DBMS_REDACT.full);
END;
e.g:
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.23
1. A sample data set with employee IDs, names, social security numbers, salary
etc. is created in the table employees in the mycompany database.
2. A data redaction policy for ssn and salary column will be applied whenever user other than
privilegeduser tries to access the employees table data
Demo
Step-by-step walkthrough for the complete demo:
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.24
Step 1: Create database
DROP DATABASE IF EXISTS mycompany;
CREATE DATABASE mycompany
WITH OWNER = enterprisedb;
Step 2: Connect to the new database
psql -d mycompany -U enterprisedb
psql (11.6.13)
Type "help" for help.
mycompany=>
Demo
A sample data set with employee IDs, names, social security numbers, salary etc. is created in the
table employees in the mycompany database.
Step 3: Create table
CREATE TABLE employees (
id SERIAL PRIMARY KEY,
name VARCHAR(40) NOT NULL,
SSN VARCHAR(11) NOT NULL,
salary MONEY);
Step 4: Add sample data
INSERT INTO employees (name, ssn, salary)
VALUES ('Sally Sample', '020-78-9345', 51234.34),
('Jane Doe', '123-33-9345', 62500.00),
('Bill Foo', '123-89-9345', 45350.00);
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.25
CREATE ROLE privilegeduser LOGIN PASSWORD 'password';
GRANT ALL ON employees TO privilegeduser;
CREATE ROLE non_privilegeduser LOGIN PASSWORD 'password';
GRANT ALL ON employees TO non_privilegeduser;
Demo
Create privileged and non-privileged user and grant the necessary access.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.26
BEGIN
DBMS_REDACT.add_policy (
object_schema => 'public',
object_name => 'employees',
policy_name => 'emp_data_protect',
policy_description => 'hide sensitive info of the
employees',
column_name => 'ssn',
function_type => DBMS_REDACT.partial,
function_parameters => 'VVVFVVFVVVV,VVV-VV-VVVV,#,1,5',
expression => 'SESSION_USER <>
''privilegeduser''',
enable => true);
END;
Demo
Create policy and on ssn and salary column for non-privileged users.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.27
BEGIN
DBMS_REDACT.alter_policy (
object_schema => 'public',
object_name => 'employees',
policy_name => 'emp_data_protect',
action => DBMS_REDACT.add_column,
column_name => 'salary',
function_type => DBMS_REDACT.full);
END;
Demo
Add salary column to emp_data_protect policy.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.28
mycompany=> c - privilegeduser
You are now connected to database "mycompany" as user "privilegeduser".
mycompany=> SELECT * FROM employees;
id | name | ssn | salary
----+--------------+-------------+------------
1 | Sally Sample | 020-78-9345 | $51,234.34
2 | Jane Doe | 123-33-9345 | $62,500.00
3 | Bill Foo | 123-89-9345 | $45,350.00
(3 rows)
Demo
By default table owner and super user can see un-redacted data.
Also, privilegeduser can see un-redacted data to whom we have exempted from the policy.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.29
mycompany=> c - non_privilegeduser
You are now connected to database "mycompany" as user
"non_privilegeduser".
mycompany=> SELECT * FROM employees;
id | name | ssn | salary
----+--------------+-------------+--------
1 | Sally Sample | ###-##-9345 | $0.00
2 | Jane Doe | ###-##-9345 | $0.00
3 | Bill Foo | ###-##-9345 | $0.00
(3 rows)
Demo
When a user other than privilegeduser tries to access the employee table will see redacted data for
ssn and salary column.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.30
mycompany=> c - privilegeduser
mycompany=> EXPLAIN VERBOSE SELECT * FROM employees;
QUERY PLAN
---------------------------------------------------------------------
Seq Scan on public.employees (cost=0.00..14.50 rows=450 width=150)
Output: id, name, ssn, salary
(2 rows)
mycompany=> c - non_privilegeduser
mycompany=> EXPLAIN VERBOSE SELECT * FROM employees;
QUERY PLAN
--------------------------------------------------------------------------
Seq Scan on public.employees (cost=0.00..240.62 rows=450 width=150)
Output: id, name, redact_partial_str(ssn, ...), redact_full_num(salary)
(2 rows)
Demo
Explain plan of the privilegeduser and non-privilegeduser user’s query.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.31
mycompany=> c - non_privilegeduser
You are now connected to database "mycompany" as user
"non_privilegeduser".
mycompany=> SELECT * FROM employees WHERE salary > 60000::money;
id | name | ssn | salary
----+----------+-------------+--------
2 | Jane Doe | ###-##-9345 | $0.00
(1 row)
How to restrict this ?
Demo
By default for the Oracle compatibility if policy created using DBMS_REDACT package procedure
the scope is “top_tlist” -- So what?
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.32
mycompany=> c - enterprisedb
mycompany=> ALTER REDACTION POLICY emp_data_protect ON employees
MODIFY COLUMN salary WITH OPTIONS (SCOPE query);
ALTER REDACTION POLICY
mycompany=> c - non_privilegeduser
mycompany=> SELECT * FROM employees WHERE salary > 60000::money;
id | name | ssn | salary
----+------+-----+--------
(0 rows)
Demo
Use native syntax to tweak scope and exception, since no provision in DBMS_REDACT package for
that.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.33
-- scope: top_tlist
mycompany=> EXPLAIN VERBOSE SELECT * FROM employees WHERE salary > 60000::money;
QUERY PLAN
--------------------------------------------------------------------------
Seq Scan on public.employees (cost=0.00..92.12 rows=150 width=150)
Output: id, name, redact_partial_str(ssn, ...), redact_full_num(salary)
Filter: (employees.salary > (60000)::money)
(3 rows)
-- scope: query
mycompany=> EXPLAIN VERBOSE SELECT * FROM employees WHERE salary > 60000::money;
QUERY PLAN
--------------------------------------------------------------------------
Seq Scan on public.employees (cost=0.00..204.62 rows=150 width=150)
Output: id, name, redact_partial_str(ssn, ...), redact_full_num(salary)
Filter: (redact_full_num(employees.salary) > (60000)::money)
(3 rows)
Demo
Explain plan of the query when scope “top_tlist” vs “query”.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.34
mycompany=> c - enterprisedb
mycompany=> ALTER REDACTION POLICY emp_data_protect ON employees
MODIFY COLUMN salary WITH OPTIONS (SCOPE top_tlist_or_error);
ALTER REDACTION POLICY
mycompany=> c - non_privilegeduser
mycompany=> SELECT * FROM employees WHERE salary > 60000::money;
ERROR: redacted column is allowed only in top targetlist
Demo
Use SCOPE for the strictness.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.35
mycompany=> c - enterprisedb
mycompany=> ALTER REDACTION POLICY emp_data_protect ON employees
MODIFY COLUMN ssn WITH OPTIONS (SCOPE top_tlist_or_error, EXCEPTION equal);
mycompany=> c - non_privilegeduser
mycompany=> SELECT * FROM employees WHERE ssn = '123-89-9345';
id | name | ssn | salary
----+----------+-------------+--------
3 | Bill Foo | ###-##-9345 | $0.00
(1 row)
mycompany=> SELECT * FROM employees WHERE ssn like '123-89%';
ERROR: redacted column is allowed only in top targetlist
Demo
Some reasons you want to show information if the non_privilegeduser has exact column value, but
your scope is top_tlist_or_error, then?
--
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.36
Who is EDB?
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.37
The largest dedicated PostgreSQL company
EDB acquires 2ndQuadrant in Sept 2020
• More customers: Than any dedicated PostgreSQL
company
• More experts: Leading PostgreSQL contributors
• More innovation: Positioned to lead in enterprise
PostgreSQL and hybrid cloud
+
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.38
EDB supercharges PostgreSQL
Questions
&
Answers
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.40
Blog:
● Native Data Redaction Capability in EDB Postgres Advanced Server 11
● Creating a Data Redaction Capability to Meet GDPR Requirements
Document:
• EDB Postgres Advanced Server : Security : Data Redaction
• EDB Postgres Advanced Server : Built-In Packages : DBMS_REDACT
Learn more about EDB data redaction:
--
Thank you !

More Related Content

PDF
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
PDF
Introducing Application Context - from the PL/SQL Potpourri
PDF
MySQL 상태 메시지 분석 및 활용
PDF
Evolution of MySQL Parallel Replication
PDF
SQLServer Database Structures
PDF
Auditing and Monitoring PostgreSQL/EPAS
 
PPTX
SQL Server 入門
PDF
Introduction to Galera Cluster
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
Introducing Application Context - from the PL/SQL Potpourri
MySQL 상태 메시지 분석 및 활용
Evolution of MySQL Parallel Replication
SQLServer Database Structures
Auditing and Monitoring PostgreSQL/EPAS
 
SQL Server 入門
Introduction to Galera Cluster

What's hot (20)

PDF
PostgreSQL13でのpg_basebackupの改善について(第13回PostgreSQLアンカンファレンス@オンライン)
PDF
Open Policy Agent (OPA) 入門
PDF
Distributed Point-in-Time Recovery with Postgres | PGConf.Russia 2018 | Eren ...
PPTX
ここからはじめる SQL Server の状態取得
PPTX
PostgreSQL.pptx
PDF
쿠알못이 Amazon EKS로 안정적인 서비스 운영하기 - 최용호(넥슨코리아) :: AWS Community Day 2020
PDF
MySQL/MariaDB Proxy Software Test
PDF
統計情報のリセットによるautovacuumへの影響について(第39回PostgreSQLアンカンファレンス@オンライン 発表資料)
PPTX
DynamoDBによるソーシャルゲーム実装 How To
PDF
pg_walinspectについて調べてみた!(第37回PostgreSQLアンカンファレンス@オンライン 発表資料)
PPTX
Maria db 이중화구성_고민하기
PDF
Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교
PPTX
PostgreSQL開発コミュニティに参加しよう!(PostgreSQL Conference Japan 2021 発表資料)
PDF
PostgreSQL13でのレプリケーション関連の改善について(第14回PostgreSQLアンカンファレンス@オンライン)
PDF
Kongの概要と導入事例
PDF
ゲームアーキテクチャパターン (Aurora Serverless / DynamoDB)
PPTX
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
PDF
あなたの知らないPostgreSQL監視の世界
PPT
PHPのセッション管理にDynamoDBを使う
PPTX
JS authentication with auth0
PostgreSQL13でのpg_basebackupの改善について(第13回PostgreSQLアンカンファレンス@オンライン)
Open Policy Agent (OPA) 入門
Distributed Point-in-Time Recovery with Postgres | PGConf.Russia 2018 | Eren ...
ここからはじめる SQL Server の状態取得
PostgreSQL.pptx
쿠알못이 Amazon EKS로 안정적인 서비스 운영하기 - 최용호(넥슨코리아) :: AWS Community Day 2020
MySQL/MariaDB Proxy Software Test
統計情報のリセットによるautovacuumへの影響について(第39回PostgreSQLアンカンファレンス@オンライン 発表資料)
DynamoDBによるソーシャルゲーム実装 How To
pg_walinspectについて調べてみた!(第37回PostgreSQLアンカンファレンス@オンライン 発表資料)
Maria db 이중화구성_고민하기
Amazon DocumentDB vs MongoDB 의 내부 아키텍쳐 와 장단점 비교
PostgreSQL開発コミュニティに参加しよう!(PostgreSQL Conference Japan 2021 発表資料)
PostgreSQL13でのレプリケーション関連の改善について(第14回PostgreSQLアンカンファレンス@オンライン)
Kongの概要と導入事例
ゲームアーキテクチャパターン (Aurora Serverless / DynamoDB)
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
あなたの知らないPostgreSQL監視の世界
PHPのセッション管理にDynamoDBを使う
JS authentication with auth0
Ad

Similar to Introducing Data Redaction - an enabler to data security in EDB Postgres Advanced Server (20)

PPTX
Data Redaction - OTN TOUR LA 2015
PPTX
Oracle Data Redaction
PDF
Air Line Management System | DBMS project
PPT
Vpd Virtual Private Database By Saurabh
PDF
OTech magazine article - Principle of Least Privilege
PDF
OER Unit 4 Virtual Private Database
DOCX
Assignment 5Understanding SQL100 points (Questions 1 to 7 eac.docx
PPTX
SQL Server Admin Best Practices with DMV's
PDF
Build a Big Data solution using DB2 for z/OS
PDF
Sybase job interview_preparation_guide
PDF
Powerful Spatial Features You Never Knew Existed in Oracle Spatial and Graph ...
PPTX
Object relational database management system
DOC
White Paper, System Z Dataset Naming Standards
PPTX
Database management system by Neeraj Bhandari ( Surkhet.Nepal )
PPTX
Intro to goldilocks inmemory db - low latency
TXT
PDF
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
PDF
Big Data: Getting off to a fast start with Big SQL (World of Watson 2016 sess...
PDF
Spec 2300 Common and Unique Design Features
Data Redaction - OTN TOUR LA 2015
Oracle Data Redaction
Air Line Management System | DBMS project
Vpd Virtual Private Database By Saurabh
OTech magazine article - Principle of Least Privilege
OER Unit 4 Virtual Private Database
Assignment 5Understanding SQL100 points (Questions 1 to 7 eac.docx
SQL Server Admin Best Practices with DMV's
Build a Big Data solution using DB2 for z/OS
Sybase job interview_preparation_guide
Powerful Spatial Features You Never Knew Existed in Oracle Spatial and Graph ...
Object relational database management system
White Paper, System Z Dataset Naming Standards
Database management system by Neeraj Bhandari ( Surkhet.Nepal )
Intro to goldilocks inmemory db - low latency
Use Performance Insights To Enhance MongoDB Performance - (Manosh Malai - Myd...
Big Data: Getting off to a fast start with Big SQL (World of Watson 2016 sess...
Spec 2300 Common and Unique Design Features
Ad

More from EDB (20)

PDF
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
 
PDF
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
 
PDF
Migre sus bases de datos Oracle a la nube
 
PDF
EFM Office Hours - APJ - July 29, 2021
 
PDF
Benchmarking Cloud Native PostgreSQL
 
PDF
Las Variaciones de la Replicación de PostgreSQL
 
PDF
NoSQL and Spatial Database Capabilities using PostgreSQL
 
PDF
Is There Anything PgBouncer Can’t Do?
 
PDF
Data Analysis with TensorFlow in PostgreSQL
 
PDF
Practical Partitioning in Production with Postgres
 
PDF
A Deeper Dive into EXPLAIN
 
PDF
IOT with PostgreSQL
 
PDF
A Journey from Oracle to PostgreSQL
 
PDF
Psql is awesome!
 
PDF
EDB 13 - New Enhancements for Security and Usability - APJ
 
PPTX
Comment sauvegarder correctement vos données
 
PDF
Cloud Native PostgreSQL - Italiano
 
PDF
New enhancements for security and usability in EDB 13
 
PPTX
Best Practices in Security with PostgreSQL
 
PDF
Cloud Native PostgreSQL - APJ
 
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
 
Migre sus bases de datos Oracle a la nube
 
EFM Office Hours - APJ - July 29, 2021
 
Benchmarking Cloud Native PostgreSQL
 
Las Variaciones de la Replicación de PostgreSQL
 
NoSQL and Spatial Database Capabilities using PostgreSQL
 
Is There Anything PgBouncer Can’t Do?
 
Data Analysis with TensorFlow in PostgreSQL
 
Practical Partitioning in Production with Postgres
 
A Deeper Dive into EXPLAIN
 
IOT with PostgreSQL
 
A Journey from Oracle to PostgreSQL
 
Psql is awesome!
 
EDB 13 - New Enhancements for Security and Usability - APJ
 
Comment sauvegarder correctement vos données
 
Cloud Native PostgreSQL - Italiano
 
New enhancements for security and usability in EDB 13
 
Best Practices in Security with PostgreSQL
 
Cloud Native PostgreSQL - APJ
 

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Encapsulation theory and applications.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Cloud computing and distributed systems.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Big Data Technologies - Introduction.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Approach and Philosophy of On baking technology
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
The Rise and Fall of 3GPP – Time for a Sabbatical?
Chapter 3 Spatial Domain Image Processing.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Encapsulation theory and applications.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Cloud computing and distributed systems.
Advanced methodologies resolving dimensionality complications for autism neur...
Digital-Transformation-Roadmap-for-Companies.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Big Data Technologies - Introduction.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Review of recent advances in non-invasive hemoglobin estimation
Unlocking AI with Model Context Protocol (MCP)
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Approach and Philosophy of On baking technology
The AUB Centre for AI in Media Proposal.docx
Dropbox Q2 2025 Financial Results & Investor Presentation

Introducing Data Redaction - an enabler to data security in EDB Postgres Advanced Server

  • 1. Data Redaction Presented by: Amul Sul Principal Software Engineer, EDB
  • 2. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.2 Welcome • This webinar is being recorded. • We will be sharing the slides and recording with you after the session. • Please submit your questions via Zoom Q&A. All questions will be answered at the end of the presentation.
  • 3. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.3 Agenda Data Redaction • Why & what Data Redaction ? • What is EDB Data Redaction ? • How to limit sensitive data exposure in EPAS ? • Provision for the Oracle compatibility in EPAS ? • Demo.
  • 4. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.4 Why & What Data Redaction ? A technique that limits sensitive data exposure. A GDPR (General Data Protection Regulation)-compliant implementation requires the use of many technical capabilities, such as authentication, authorization, access control, virtual database, and encryption. One of the techniques often considered is data redaction to limits sensitive data exposure by dynamically changing data as it is displayed for specific users. Data redaction in EPAS version prior v11 and PostgreSQL -- See Creating a Data Redaction Capability to Meet GDPR Requirements Using EDB Postgres blog, shows how we can use the PostgreSQL search_path, user defined functions and views to add data redaction protection.
  • 5. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.5 What is EDB Data Redaction ? Limits sensitive data exposure by dynamically changing data as it is displayed for specific users. Data Policy Other User Privileged User Custom Data Masking logic
  • 6. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.6 What is EDB Data Redaction ? Limits sensitive data exposure by dynamically changing data as it is displayed for specific users. Policy Name SSN Sally Sample 020-78-9345 Jane Doe 123-33-9345 Emp Table Other User Privileged User Name SSN Sally Sample xxx-xx-9345 Jane Doe xxx-xx-9345 Name SSN Sally Sample 020-78-9345 Jane Doe 123-33-9345
  • 7. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.7 How to limit sensitive data exposure in EPAS ? Using Native Data Redaction Capability of EDB Postgres Advanced Server. Redaction functionPolicy Scope and exception options Policy expression Redaction policies allow a user to choose redaction behavior via redaction function. More than one redaction policy can be created on the same table, but a column can only be associated with one policy. Flexibility to choose when actual redaction should apply and exemptions on columns in the query via the scope and exception options. Boolean expression for the policy; determines how the policy is to be applied. The redaction occurs if this policy expression is evaluated to TRUE.
  • 8. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.8 Policy Create policy: CREATE REDACTION POLICY name ON table_name [ FOR ( expression ) ] [ ADD column_name USING redaction_function() [ WITH OPTIONS ( redaction_options ) ] ] [, … ]; Alter Policy: ALTER REDACTION POLICY name ON table_name ... ➔Rename policy, enable or disable the policy ➔Change policy expression ➔Add more column or remove existing one ➔Change redaction_function and redaction_options
  • 9. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.9 Policy Create policy on emp table: CREATE REDACTION POLICY emp_protect ON emp ADD COLUMN ssn USING redact_ssn(ssn); And the table description will be:
  • 10. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.10 Redaction function CREATE FUNCTION redact_ssn (ssn varchar(11)) RETURNS varchar(11) AS $$ SELECT overlay (ssn placing 'xxx-xx' from 1); $$ LANGUAGE SQL; Note : Return type of the redaction function should be same as the column type. Policy Other User Name SSN Sally Sample xxx-xx-9345 Jane Doe xxx-xx-9345
  • 11. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.11 Scope & exception options Previously seen table description: ➢ SCOPE: Identified the query part where redaction to be applied for the column. ○ Values: query, top_tlist, top_tlist_or_error. ➢ EXCEPTION: Identified the query part where redaction to be exempted. ○ Values: none, equal, leakproof.
  • 12. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.12 Policy expression ALTER REDACTION POLICY emp_protect ON emp FOR (SESSION_USER <> 'privileged_user'); OR CREATE REDACTION POLICY emp_protect ON emp FOR (SESSION_USER <> 'privileged_user') ADD COLUMN ssn USING redact_ssn(ssn);
  • 13. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.13 Oracle compatibility Provision in EPAS ? DBMS_REDACT package Redaction functionPolicy Policy expression Like Oracle, provides various redaction type and supporting functions. DBMS_REDACT package provides Oracle like procedure to add, alter, enable, disable or drop the policy. Same as the native support, the redaction occurs if this policy expression is evaluated to TRUE. Scope and exception options No provision, but user can use native alter syntax to set scope and exception.
  • 14. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.14 Policy Create policy on emp table: BEGIN DBMS_REDACT.add_policy ( object_schema => 'public', object_name => 'emp', policy_name => 'emp_protect', policy_description => 'policy for emp table ...', column_name => 'ssn', function_type => DBMS_REDACT.partial, function_parameters => DBMS_REDACT.REDACT_US_SSN_F5, expression => '1=1', enable => true); END;
  • 15. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.15 Policy Create policy on emp table: BEGIN DBMS_REDACT.add_policy ( object_schema => 'public', object_name => 'emp', policy_name => 'emp_protect', policy_description => 'policy for emp table ...', column_name => 'ssn', function_type => DBMS_REDACT.partial, function_parameters => DBMS_REDACT.REDACT_US_SSN_F5, expression => '1=1', enable => true); END;
  • 16. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.16 Function_type and Function_parameters: BEGIN DBMS_REDACT.add_policy ( object_schema => 'public', object_name => 'emp', policy_name => 'emp_protect', policy_description => 'policy for emp table ...', column_name => 'ssn', function_type => DBMS_REDACT.partial, function_parameters => DBMS_REDACT.REDACT_US_SSN_F5, expression => '1=1', enable => true); END; Redaction function
  • 17. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.17 Parameters: function_type Redaction function NONE No redaction. FULL Full redaction, redacts full values of the column data. PARTIAL Partial redaction, redacts a portion of the column data. function_parameters needed. RANDOM Random redaction, each query results in a different random value depending on the datatype of the column. REGEXP Regular Expression based redaction, searches for the pattern of data to redact. regexp_pattern, regexp_replace_string, regexp_position, regexp_occurence, regexp_match_parameter needed. CUSTOM Custom redaction type.
  • 18. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.18 Parameters: function_parameters needed for PARTIAL type. 1. REDACT_US_SSN_F5 - Redacts the first 5 numbers of SSN. - Example: The number 123-45-6789 becomes XXX- XX-6789 1. REDACT_NA_PHONE_NUMBER - Redacts the North American phone number by 0 leaving the area code. - Example: 1234567890 becomes 1230000000. 1. REDACT_DATE_MILLENNIUM - Redacts a date that is in the DD-MM-YY format. - Example: Redacts all date to 01-JAN-2000. So on… Partial redaction supports only Character, Number and Date types. Redaction function
  • 19. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.19 Existing function_parameters constants not matching my requirement, then? Answer: No problem, you can use your function_parameters. Here are the previously seen function_parameters constants for Character, Number and Date type respectively and its internal definition. 1. REDACT_US_SSN_F5 => 'VVVFVVFVVVV,VVV-VV-VVVV,X,1,5' - input_fmt,output_fmt,mask_char,start,end 1. REDACT_NA_PHONE_NUMBER => '0,4,10' - mask_digit,start,end 1. REDACT_DATE_MILLENNIUM => 'm1d1y2000' - monthDigit,dayDigit,yearDigit - You can replace hours, minutes and seconds too. Redaction function
  • 20. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.20 Policy expression: BEGIN DBMS_REDACT.add_policy ( object_schema => 'public', object_name => 'emp', policy_name => 'emp_protect', policy_description => 'policy for emp table ...', column_name => 'ssn', function_type => DBMS_REDACT.partial, function_parameters => DBMS_REDACT.REDACT_US_SSN_F5, expression => '1=1', enable => true); END; Policy expression
  • 21. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.21 Alter Policy Action parameter of ALTER_POLICY() decides what to alter: 1. Add column to the existing policy, - action => ADD_COLUMN 1. Modify/Drop column redaction method, - action => MODIFY_COLUMN 1. Modify policy expression, - action => MODIFY_EXPRESSION 1. Set policy description, and - action => SET_POLICY_DESCRIPTION 1. Set column description - action => SET_COLUMN_DESCRIPTION
  • 22. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.22 Alter Policy Alter policy to add another column: BEGIN DBMS_REDACT.alter_policy ( object_schema => 'public', object_name => 'emp', policy_name => 'emp_protect', action => DBMS_REDACT.add_column, column_name => 'salary', function_type => DBMS_REDACT.full); END; e.g:
  • 23. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.23 1. A sample data set with employee IDs, names, social security numbers, salary etc. is created in the table employees in the mycompany database. 2. A data redaction policy for ssn and salary column will be applied whenever user other than privilegeduser tries to access the employees table data Demo Step-by-step walkthrough for the complete demo:
  • 24. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.24 Step 1: Create database DROP DATABASE IF EXISTS mycompany; CREATE DATABASE mycompany WITH OWNER = enterprisedb; Step 2: Connect to the new database psql -d mycompany -U enterprisedb psql (11.6.13) Type "help" for help. mycompany=> Demo A sample data set with employee IDs, names, social security numbers, salary etc. is created in the table employees in the mycompany database. Step 3: Create table CREATE TABLE employees ( id SERIAL PRIMARY KEY, name VARCHAR(40) NOT NULL, SSN VARCHAR(11) NOT NULL, salary MONEY); Step 4: Add sample data INSERT INTO employees (name, ssn, salary) VALUES ('Sally Sample', '020-78-9345', 51234.34), ('Jane Doe', '123-33-9345', 62500.00), ('Bill Foo', '123-89-9345', 45350.00);
  • 25. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.25 CREATE ROLE privilegeduser LOGIN PASSWORD 'password'; GRANT ALL ON employees TO privilegeduser; CREATE ROLE non_privilegeduser LOGIN PASSWORD 'password'; GRANT ALL ON employees TO non_privilegeduser; Demo Create privileged and non-privileged user and grant the necessary access.
  • 26. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.26 BEGIN DBMS_REDACT.add_policy ( object_schema => 'public', object_name => 'employees', policy_name => 'emp_data_protect', policy_description => 'hide sensitive info of the employees', column_name => 'ssn', function_type => DBMS_REDACT.partial, function_parameters => 'VVVFVVFVVVV,VVV-VV-VVVV,#,1,5', expression => 'SESSION_USER <> ''privilegeduser''', enable => true); END; Demo Create policy and on ssn and salary column for non-privileged users.
  • 27. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.27 BEGIN DBMS_REDACT.alter_policy ( object_schema => 'public', object_name => 'employees', policy_name => 'emp_data_protect', action => DBMS_REDACT.add_column, column_name => 'salary', function_type => DBMS_REDACT.full); END; Demo Add salary column to emp_data_protect policy.
  • 28. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.28 mycompany=> c - privilegeduser You are now connected to database "mycompany" as user "privilegeduser". mycompany=> SELECT * FROM employees; id | name | ssn | salary ----+--------------+-------------+------------ 1 | Sally Sample | 020-78-9345 | $51,234.34 2 | Jane Doe | 123-33-9345 | $62,500.00 3 | Bill Foo | 123-89-9345 | $45,350.00 (3 rows) Demo By default table owner and super user can see un-redacted data. Also, privilegeduser can see un-redacted data to whom we have exempted from the policy.
  • 29. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.29 mycompany=> c - non_privilegeduser You are now connected to database "mycompany" as user "non_privilegeduser". mycompany=> SELECT * FROM employees; id | name | ssn | salary ----+--------------+-------------+-------- 1 | Sally Sample | ###-##-9345 | $0.00 2 | Jane Doe | ###-##-9345 | $0.00 3 | Bill Foo | ###-##-9345 | $0.00 (3 rows) Demo When a user other than privilegeduser tries to access the employee table will see redacted data for ssn and salary column.
  • 30. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.30 mycompany=> c - privilegeduser mycompany=> EXPLAIN VERBOSE SELECT * FROM employees; QUERY PLAN --------------------------------------------------------------------- Seq Scan on public.employees (cost=0.00..14.50 rows=450 width=150) Output: id, name, ssn, salary (2 rows) mycompany=> c - non_privilegeduser mycompany=> EXPLAIN VERBOSE SELECT * FROM employees; QUERY PLAN -------------------------------------------------------------------------- Seq Scan on public.employees (cost=0.00..240.62 rows=450 width=150) Output: id, name, redact_partial_str(ssn, ...), redact_full_num(salary) (2 rows) Demo Explain plan of the privilegeduser and non-privilegeduser user’s query.
  • 31. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.31 mycompany=> c - non_privilegeduser You are now connected to database "mycompany" as user "non_privilegeduser". mycompany=> SELECT * FROM employees WHERE salary > 60000::money; id | name | ssn | salary ----+----------+-------------+-------- 2 | Jane Doe | ###-##-9345 | $0.00 (1 row) How to restrict this ? Demo By default for the Oracle compatibility if policy created using DBMS_REDACT package procedure the scope is “top_tlist” -- So what?
  • 32. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.32 mycompany=> c - enterprisedb mycompany=> ALTER REDACTION POLICY emp_data_protect ON employees MODIFY COLUMN salary WITH OPTIONS (SCOPE query); ALTER REDACTION POLICY mycompany=> c - non_privilegeduser mycompany=> SELECT * FROM employees WHERE salary > 60000::money; id | name | ssn | salary ----+------+-----+-------- (0 rows) Demo Use native syntax to tweak scope and exception, since no provision in DBMS_REDACT package for that.
  • 33. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.33 -- scope: top_tlist mycompany=> EXPLAIN VERBOSE SELECT * FROM employees WHERE salary > 60000::money; QUERY PLAN -------------------------------------------------------------------------- Seq Scan on public.employees (cost=0.00..92.12 rows=150 width=150) Output: id, name, redact_partial_str(ssn, ...), redact_full_num(salary) Filter: (employees.salary > (60000)::money) (3 rows) -- scope: query mycompany=> EXPLAIN VERBOSE SELECT * FROM employees WHERE salary > 60000::money; QUERY PLAN -------------------------------------------------------------------------- Seq Scan on public.employees (cost=0.00..204.62 rows=150 width=150) Output: id, name, redact_partial_str(ssn, ...), redact_full_num(salary) Filter: (redact_full_num(employees.salary) > (60000)::money) (3 rows) Demo Explain plan of the query when scope “top_tlist” vs “query”.
  • 34. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.34 mycompany=> c - enterprisedb mycompany=> ALTER REDACTION POLICY emp_data_protect ON employees MODIFY COLUMN salary WITH OPTIONS (SCOPE top_tlist_or_error); ALTER REDACTION POLICY mycompany=> c - non_privilegeduser mycompany=> SELECT * FROM employees WHERE salary > 60000::money; ERROR: redacted column is allowed only in top targetlist Demo Use SCOPE for the strictness.
  • 35. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.35 mycompany=> c - enterprisedb mycompany=> ALTER REDACTION POLICY emp_data_protect ON employees MODIFY COLUMN ssn WITH OPTIONS (SCOPE top_tlist_or_error, EXCEPTION equal); mycompany=> c - non_privilegeduser mycompany=> SELECT * FROM employees WHERE ssn = '123-89-9345'; id | name | ssn | salary ----+----------+-------------+-------- 3 | Bill Foo | ###-##-9345 | $0.00 (1 row) mycompany=> SELECT * FROM employees WHERE ssn like '123-89%'; ERROR: redacted column is allowed only in top targetlist Demo Some reasons you want to show information if the non_privilegeduser has exact column value, but your scope is top_tlist_or_error, then? --
  • 36. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.36 Who is EDB?
  • 37. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.37 The largest dedicated PostgreSQL company EDB acquires 2ndQuadrant in Sept 2020 • More customers: Than any dedicated PostgreSQL company • More experts: Leading PostgreSQL contributors • More innovation: Positioned to lead in enterprise PostgreSQL and hybrid cloud +
  • 38. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.38 EDB supercharges PostgreSQL
  • 40. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.40 Blog: ● Native Data Redaction Capability in EDB Postgres Advanced Server 11 ● Creating a Data Redaction Capability to Meet GDPR Requirements Document: • EDB Postgres Advanced Server : Security : Data Redaction • EDB Postgres Advanced Server : Built-In Packages : DBMS_REDACT Learn more about EDB data redaction: --