[go: up one dir, main page]

Skip to content

Trying out Blackbox using "latest" Docker. Issue with anon.random_string()

Doing a simple POC to test out Blackbox method of Masking on Dec 06, 2024 so using the latest Docker Image. Im running latest Docker Desktop on Windows.

Command I'm using to process my backup is run in VS Code Terminal Powershell

cat masktestdump.sql,maskrules.sql | docker run --rm -i registry.gitlab.com/dalibo/postgresql_anonymizer /dump.sh > anon_dump_latest.sql

This runs with no errors or output.

This is subset of the datbase dump for my sample table and data:

CREATE TABLE public.employee (
    id integer NOT NULL,
    first_name character varying(20) NOT NULL,
    last_name character varying(20) NOT NULL,
    postalcode character(6),
    sin integer,
    comment character varying(100),
    salary bigint NOT NULL
);

--
-- Data for Name: employee; Type: TABLE DATA; Schema: public; Owner: SYSDBA
--

COPY public.employee (id, first_name, last_name, postalcode, sin, comment, salary) FROM stdin;
4	Ben	Dempsey	M2N6Z9	1234567	\N	150000
5	Frank	Zappa	N8R1R9	2323232	I am awesome	2000000
6	Charles	Bronson	C9S3R2	2323232	Tough guy	40000
\.

My Masking Rules

SELECT pg_catalog.set_config('search_path', 'public', false);

CREATE EXTENSION anon CASCADE;
SELECT anon.init();

SECURITY LABEL FOR anon ON COLUMN employee.last_name
IS 'MASKED WITH FUNCTION anon.dummy_last_name()';

SECURITY LABEL FOR anon ON COLUMN employee.first_name
IS 'MASKED WITH FUNCTION anon.dummy_first_name()';

SECURITY LABEL FOR anon ON COLUMN employee.postalcode
IS 'MASKED WITH FUNCTION anon.random_string(6)';

SECURITY LABEL FOR anon ON COLUMN employee.comment
IS 'MASKED WITH FUNCTION anon.lorem_ipsum( characters := 50 )';

SECURITY LABEL FOR anon ON COLUMN employee.salary
IS 'MASKED WITH FUNCTION anon.noise(salary,0.33)';

SECURITY LABEL FOR anon ON COLUMN employee.sin
IS 'MASKED WITH FUNCTION anon.random_in_int4range(''[10000,1000001]'')';

Seems to run ok, but the "anon.random_string(6)" seems to only output a single character instead of the 6 as in the parameter

COPY public.employee (id, first_name, last_name, postalcode, sin, comment, salary) FROM stdin;
4	Adela	Buckridge	a	18227	Great how before current effort because. Simply in	185237
5	Anastacio	Boyer	0	783427	Hundred unit music many. But mother however drug c	1968714
6	Neal	Hackett	V	966247	Individual low nice character home Congress preven	50557
\.

Was wonding if anyone could see an issue.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information