anon
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_anon | 3.1.3 | SEC | PostgreSQL | Rust |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 7070 | anon | No | Yes | Yes | Yes | No | No | anon |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 3.1.3 | 1817161514 | pg_anon | - |
| RPM | PIGSTY | 3.1.3 | 1817161514 | pg_anon_$v | - |
| DEB | PIGSTY | 3.1.3 | 1817161514 | postgresql-$v-pg-anon | - |
Build
You can build the RPM / DEB packages for pg_anon using pig build:
Install
You can install pg_anon directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
Sources:
anon is PostgreSQL Anonymizer. It applies declarative masking rules for protected query access, produces anonymized data sets, and provides pseudonymization and randomized-response helpers. Use it when realistic data must remain useful without exposing the original sensitive values; treat masking policy, role grants, and access to the unmasked database as part of the security boundary.
Core Workflow
Load anon for sessions in the target database, install the extension, and enable transparent dynamic masking. New connections pick up database-level settings.
Mark a login as masked and attach masking rules to sensitive columns:
Queries made as reporting see the transformed values. Privileged users still see the originals, so do not grant masked roles a path around the policy.
Masking Strategies
- Dynamic masking transforms results for roles labeled
MASKEDwithout rewriting the table. - Static masking permanently rewrites selected data and is appropriate for disposable development or test copies.
- Anonymous dumps and replicas produce sanitized exports or downstream copies.
- Masking views and data wrappers expose a deliberately reduced or transformed projection.
- Pseudonymization uses deterministic transforms when joins or repeated values must remain consistent.
Important Objects
anon.dummy_*,anon.random_*, andanon.partial(...)generate or partially conceal values.anon.hash(text)andanon.digest(text, text, text)provide deterministic transformations. In 3.1.2 they were markedRESTRICTEDto limit brute-force exposure.anon.ldp_grrm(value, epsilon, max_v)andanon.ldp_grrm_pttt(value, truth_probability, max_v)implement generalized randomized response for local differential privacy.anon.ldp_truth_probability(...)andanon.ldp_lie_probability(...)help inspect randomized-response probabilities.- Security labels on roles and columns define who is masked and how each value is transformed.
Operational Notes
anon is superuser-installed and non-relocatable. Test every policy with the same grants and connection path used by the intended consumer. Randomization is not automatically deterministic; use a confirmed pseudonymization function when stable equality is required. Static anonymization is destructive, so run it on a copy and verify constraints and application behavior afterward.
Version 3.1.3 reruns missing ARM builds and changes release metadata, with no new SQL workflow. The material delta since 3.1.1 is the 3.1.2 security hardening for anon.hash and anon.digest; deployments using those functions should upgrade rather than relying on the old labels.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)