Reputation: 447
Using the postgresql-anonymizer
Postgres extension I've set security labels for masking on a number of columns.
e.g.
SECURITY LABEL FOR anon ON COLUMN "Customer"."firstName" IS 'MASKED WITH FUNCTION anon.fake_first_name()
I want a way to query if it's been added, and see what the label is. How do I do this?
Upvotes: 1
Views: 956
Reputation: 111
To display all the masking rules declared in the current database, check out the anon.pg_masking_rules:
SELECT * FROM anon.pg_masking_rules;
https://postgresql-anonymizer.readthedocs.io/en/latest/declare_masking_rules/#listing-masking-rules
Upvotes: 0
Reputation: 447
Query pg_seclabels
to find the table and columns the labels are assigned to.
objname
will contain the table and column e.g. "Users"."firstName"
, label
, as the name gives away, will contain the label. e.g. 'MASKED WITH FUNCTION anon.fake_first_name()
SELECT objname, label
FROM pg_seclabels
WHERE provider = 'anon';
Upvotes: 1