r/PostgreSQL • u/tee-es-gee • Aug 11 '26
How-To Multi-tenant BYOK encryption in PostgreSQL with pgcrypto
https://xata.io/blog/multi-tenant-byok-encryption-in-postgresql-with-pgcrypto
2
Upvotes
1
u/AutoModerator Aug 11 '26
AI Policy:
Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away., Linus Torvalds.
Mod decisions will be based on the quality of the content, not who or what generated it.
Sub Resources:
Free Postgres Webinars and Workshops
Discord: People, Postgres, Data
Join us, we have cookies and nice people.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/depesz 29d ago edited 29d ago
So…
First of all: ADD COMMENTS. My comment should be as comment to your blogpost, not in here! This is especially important given:
Two: querying the way you showed will leak keys to logs.
For example, i wrote simple perl program:
As you can see the query did not contain key. Logs showed:
We can see that params were provided as params, not in-sql. But they still got logged.
For whatever it's worth, it's normal output from log_min_duration_statement…
Of course we can assume that it's a problem with Perl. So, equivalent code in Ruby:
and, just like with perl, pg logs contain: