Supabase 刚刚发布了可搜索加密功能。
Searchable field-level encryption on Supabase with CipherStash

原始链接: https://supabase.com/blog/searchable-field-level-encryption-with-cipherstash

CipherStash 为 Supabase 推出了数据级访问控制(DLAC)集成,使开发者能够在不牺牲数据库功能的前提下实现字段级加密。 传统的加密方式往往会破坏 Postgres 的搜索、排序和联接(join)等功能。CipherStash 通过在应用层加密数据并将可搜索加密元数据(SEM)存储在数据库中来解决这一问题。这使得 Postgres 能够在不接触明文的情况下对加密数据执行复杂查询。 主要优势包括: * **安全性:** 通过零知识服务 ZeroKMS 使用唯一密钥加密数据,确保 Supabase 和 CipherStash 均无法访问您的敏感信息。 * **性能:** 与 Supabase SDK、Prisma 和 Drizzle 无缝集成,保留了标准的 SQL 操作(如 WHERE、ORDER BY、JSON 查询)。 * **合规性:** 通过最小化数据泄露面,简化了对 HIPAA、GDPR 和 SOC 2 等法规的合规要求。 * **易用性:** 可通过单条 CLI 命令(`npx stash init --supabase`)进行部署。 对于旧版工具或非应用程序环境,CipherStash Proxy 提供了一个安全、透明的桥梁来处理加密数据。这一集成为处理敏感数据提供了强大的“第三种选择”:在不影响开发者体验或数据库性能的前提下,实现强大的安全性。

CipherStash 是一项为 Supabase 等数据库提供列级可搜索加密的服务。它允许组织在保持数据加密状态的同时,执行数据库操作,如过滤、排序和范围查询。 **主要功能包括:** * **访问控制:** 即使数据库本身遭到入侵,数据依然保持加密状态。解密过程在应用层进行,并与个人用户身份(通过 JWT)绑定,而非服务账户。 * **可搜索加密:** 通过使用 OPE(顺序保留加密)和 ORE(顺序揭示加密)等技术,系统允许对加密数据进行索引查询,而无需解密整个表。 * **审计:** 每次解密请求都会通过“ZeroKMS”服务,从而创建一份不可篡改的审计追踪记录,准确记录谁访问了特定数据,这与数据库自身的查询日志是相互独立的。 * **集成:** 通过 SDK(Prisma、Drizzle、Supabase)为开发者提供支持,并为无法直接使用 SDK 的旧版应用程序提供代理层。 团队声明,虽然该系统可以防御未经授权的数据库访问和 SQL 注入,但它并非万能方案;它依赖于应用边界作为信任层。该项目旨在满足企业合规性和安全性需求,而非防止系统全面崩溃带来的风险。
相关文章

原文

The CipherStash integration for Supabase is now available.

CipherStash is a Data Level Access Control (DLAC) platform for applications built on Postgres. DLAC extends traditional access control, which typically operates at the row or table level, down to individual encrypted values, so policies are enforced at decryption rather than at the query layer.

With CipherStash, teams can encrypt sensitive fields at the application layer with a unique key per value, run searches and joins against encrypted data without decrypting it, and keep keys under their own control through ZeroKMS, CipherStash's zero-knowledge key management service. Because keys never leave your control, neither CipherStash nor Supabase can access your plaintext data.

The Supabase integration enables teams to add field-level encryption to any Supabase project using the encrypted Supabase SDK wrapper without changing the schema. Setup is one CLI command: npx stash init --supabase.

Most teams that handle regulated data end up choosing between two bad options:

  1. Use traditional field-level encryption: Encrypted values are random bytes as far as Postgres is concerned. WHERE email = ? matches nothing, indexes stop working, and joins fail. The only way to search is to pull every row, decrypt it in your app, and filter in memory. Teams end up building expensive workarounds or dropping the feature entirely.
  2. Skip encryption: The application stays fast, but when a breach happens, plaintext sensitive data is the first thing auditors ask about.

CipherStash gives you a third option.

DLAC extends access control down to individual encrypted values. Encryption happens inside your application before data reaches the database. Each value is stored as a single JSON payload containing the ciphertext alongside Searchable Encrypted Metadata (SEM). That is enough for Postgres to filter, sort, and join, but not enough to recover the original value. Queries are converted to SEM on the way in, Postgres matches against the stored SEM, and only the ciphertexts your application is authorized to decrypt come back. Every encrypted value carries a policy stating who can read it and under what condition. That policy is enforced at decryption, not at the query layer.

For teams under HIPAA, GDPR, or SOC 2, you keep Postgres, Supabase, and search, with a shorter compliance review and a smaller breach surface.

Add DLAC to your existing TypeScript application with CipherStash Stack. It works natively with Supabase.js, Drizzle, and Prisma Next. Encryption and decryption happen transparently in your application. Columns you mark as encrypted flow through the SDK and everything else behaves as it always has: WHERE clauses, fuzzy text matching, ORDER BY, and even JSON queries all continue to work over encrypted data.

Encryption keys are managed through ZeroKMS. Each encrypted value gets its own key, derived on demand, and keys can be split across regions to meet data residency requirements including frameworks like FedRAMP and IL4.

For cases where the SDK isn't a fit, such as analytics jobs, admin tooling, background workers in other languages, or anywhere you need direct database access outside your application, CipherStash Proxy provides a secure escape hatch. The proxy speaks the Postgres wire protocol and handles encryption and decryption transparently, so existing tools and SQL clients can work with encrypted data without code changes.

Add CipherStash to your Supabase project

联系我们 contact @ memedata.com