michelp / pgsodium

Modern cryptography for PostgreSQL using libsodium.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jsonb type support

Code-Hex opened this issue · comments

Hello! Thank you for the great extension.

Are there any plans to enable TCE on jsonb data? It would be even better if it could be supported!

Currently, we got this error:

ECURITY LABEL FOR pgsodium ON COLUMN temp_table.content IS 'ENCRYPT WITH KEY ID c9c52d1c-372d-4187-bcd6-dad2a06c3992';
ERROR:  syntax error at or near ","
LINE 12: ,
         ^
QUERY:
    DROP VIEW IF EXISTS pg_temp_13.decrypted_temp_table;
    CREATE VIEW pg_temp_13.decrypted_temp_table AS SELECT
                id,
        content,
,
        created_at
    FROM temp_table;
    ALTER VIEW pg_temp_13.decrypted_temp_table OWNER TO postgres;

CONTEXT:  PL/pgSQL function pgsodium.create_mask_view(oid,integer,boolean) line 39 at EXECUTE
SQL statement "SELECT pgsodium.create_mask_view(objoid, objsubid, debug)
    FROM pg_catalog.pg_seclabel sl
    WHERE sl.objoid = target
      AND sl.label ILIKE 'ENCRYPT%'
      AND sl.provider = 'pgsodium'"
PL/pgSQL function pgsodium.update_mask(oid,boolean) line 4 at PERFORM
SQL statement "SELECT pgsodium.update_mask(objoid, debug)
    FROM pg_catalog.pg_seclabel sl
    JOIN pg_catalog.pg_class cl ON (cl.oid = sl.objoid)
    WHERE label ilike 'ENCRYPT%'
       AND cl.relowner = session_user::regrole::oid
       AND provider = 'pgsodium'
           AND objoid::regclass != 'pgsodium.key'::regclass"
PL/pgSQL function pgsodium.update_masks(boolean) line 3 at PERFORM
SQL statement "SELECT pgsodium.update_masks()"
PL/pgSQL function pgsodium.trg_mask_update() line 9 at PERFORM
CREATE TABLE temp_table (
    id varchar(128) NOT NULL,
    content jsonb NOT NULL,
    created_at timestamp with time zone NOT NULL,
    PRIMARY KEY (id)
);

We use this on supabase (hosted):

> SELECT VERSION();
PostgreSQL 15.1 (Ubuntu 15.1-1.pgdg20.04+1) on aarch64-unknown-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit

That is definitely highly important feature, I would say.. I didn't think it would be an issue, to be honest.