pg_columnmask
pg_columnmask · Amazon Aurora PostgreSQL extension for role-based dynamic column masking without changing stored data.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101045 | pg_columnmask | pg_columnmask | 1.1.0 | SEC | Unknown | C |
PostgreSQL · 16, 17, 18
Usage
Sources:
- AWS dynamic masking overview
- AWS policy procedure reference
- AWS predefined masking functions
- AWS security best practices
pg_columnmask is an Amazon Aurora PostgreSQL extension for role-based dynamic column masking. It transforms values read by users covered by a masking policy while leaving stored data unchanged. This is an Aurora-managed feature, not a portable open-source extension.
Core Workflow
Create the extension as rds_superuser, define a role, and add a policy as the table owner, rds_superuser, or configured policy administrator:
Reconnect sessions opened before extension installation, then test under the target role rather than only as an administrator:
Object Index
pgcolumnmask.create_masking_policy(name, regclass, jsonb, name[], int)creates a weighted role policy.alter_masking_policy,rename_masking_policy, anddrop_masking_policymanage policies.mask_textsupports a mask character, visible prefix/suffix, and hash-mask mode.mask_emailcan mask the local part, domain, or both.mask_timestampreplaces all or one timestamp component.pgcolumnmask.policy_admin_rolnamedelegates policy administration through the Aurora cluster parameter group.
Operational Notes
AWS currently documents availability on Aurora PostgreSQL 16.10 and later and 17.6 and later; confirm the target engine’s extension version before deployment. Installation is per database, and sessions connected before installation must reconnect.
Masking is an additional display-control layer, not encryption or a substitute for privileges. Values read in WHERE, joins, subqueries, and RETURNING are masked, while constraints apply to real stored values. Table triggers can see unmasked transition rows and can leak them; review trigger code carefully. The independent GUCs pgcolumnmask.restrict_dml_triggers_for_masked_users and pgcolumnmask.restrict_iot_triggers_for_masked_users default to false and can prohibit relevant trigger execution when required. Test dumps, replication, exports, views, and all application DML as the actual masked roles.