How a 60-line Doctrine type adds column-level encryption to a Symfony app
A developer building InvoicePilot, a Shopify invoicing app, found the application stored customer names, addresses and emails in plain text in a PostgreSQL database on an unencrypted VPS. To honestly answer a compliance audit question about data-at-rest encryption, they implemented application-level column encryption using PHP's built-in libsodium library in roughly 60 lines of code via a custom Doctrine type. The approach targets realistic, lower-cost threats such as leaked database dumps, misconfigured backup storage, and contractor access to restored snapshots, rather than full host compromises. However, the author notes that once a database column becomes an encrypted blob, four previously reliable features — including some that fail silently — stop working as expected. The post also warns that the entire approach is undermined if the encryption key is stored alongside the data it protects.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in