【发布时间】:2022-10-08 04:48:25
【问题描述】:
为了遵守隐私准则,我想将某些列的内容二进制混淆到其他角色,包括管理角色/开发人员。 一个表可能如下所示:
create table customer (
id serial primary key,
role text not null default session_user,
name text not null,
address text not null,
phone bigint default null
);
create policy customer_policy on customer
for all to public using (role = session_user);
在此示例中,名称、地址和电话等列内容不应对其他角色可见。 该策略仅保证其他数据库用户的角色看不到记录,但具有更高权限的管理员(例如,管理员)仍然可以看到数据。
我的想法是密码存储在另一个由相应角色创建和更改的表中。然后使用此密码对相关列进行加密和解密。
这是如何实现的,或者 PostgreSQL 是否已经为此提供了解决方案?
【问题讨论】:
标签: postgresql security encryption obfuscation