Skip to content
docker · supabase · postgres · fastify

Supabase's Postgres API,patched

The REST API Supabase Studio uses to manage Postgres, rebuilt from upstream's pinned commit with our patches on top.

postgres-metaImage
v0.100.0Upstream
Node.js 22Runtime
Fastify 5Server lib

What it is

Overview

Overview

postgres-meta is the REST API Supabase Studio uses to list and change tables, columns, policies, roles and functions, generate types, and run SQL. This build is upstream supabase/postgres-meta at a pinned tag and commit, with services/postgres-meta/patches/ applied before npm ci.

Upstream v0.100.0 ships Fastify 4, which is end-of-life: GHSA-p68q-wchp-6fh7 and three other HIGH advisories are fixed only in Fastify 5.12.2 (upstream issue #1156). Its formatter, oxfmt 0.66.0, also pins tinypool 2.1.0, a critical prototype-pollution RCE. The patch moves it to Fastify 5 and overrides tinypool to 2.1.2.

The runtime image is node:22-slim without npm or corepack, running as node (uid 1000).

Keeping up with upstream

Upgrading

Upgrading

  1. Move PG_META_TAG and PG_META_COMMIT in the Dockerfile to the new upstream release.
  2. Rebase patches/0001-fastify-5.patch onto it; git apply --check fails loudly if upstream touched the same lines.
  3. Run upstream’s suite (vitest run against its test/db Postgres). The response snapshots are what Studio depends on, so they must pass unchanged.
  4. Bump version.toml; CI publishes registry.gitlab.com/kbve/workspace/postgres-meta:<version>.

The patch can be dropped once upstream ships Fastify 5.

Questions

Frequently asked

Why rebuild postgres-meta instead of running the upstream image?

Upstream v0.100.0 still ships Fastify 4, which is end-of-life with four HIGH advisories fixed only in Fastify 5, and a critical tinypool advisory through its formatter. Rebuilding from the same commit with a small patch set moves it to Fastify 5 without changing what Studio sees.

What do the patches change?

Dependency versions (Fastify 5 and its plugins, pino 10, typebox 0.34, piscina 5.3.2, a tinypool override) and the few source lines those versions require. Responses are unchanged; upstream's full test suite, including its response snapshots, passes against the patched build.

How is a new upstream release picked up?

Move PG_META_TAG and PG_META_COMMIT in the Dockerfile, rebase the patch onto the new tag, run upstream's test suite, and bump version.toml.