Skip to content

Site-record public exposure: GET /sites is unauthenticated

Every deployment answers an anonymous site-list request with each row of kywi_sites in full: id, slug, name, domain, locale and theme.

The site-list route was never given an auth check. Every other admin surface starts its handler with unauthorized() or forbidden(); this one is ten lines end to end, and none of them checks who is asking. The result: any caller who can reach a Kywi deployment can list every site it hosts, in full, with no credential.

GET/api/v1/sitesNo auth

Returns every row of kywi_sites — a plain db.select().from(kywiSites) with no projection, so every column the table has comes back: id, slug, name, domain, defaultLocale, theme, createdAt, updatedAt. GET /api/v1/sites/:siteId is the same query narrowed to one row and is exactly as open.

This is the real, unmodified body a plain request gets back — no Authorization header sent — from this workspace's own docs deployment:

bash
curl -s http://localhost:3700/api/v1/sites
response — anonymous, 200json
{
  "data": [
    {
      "id": "c853e273-dd4e-4f90-a7b5-f64427b402ee",
      "slug": "site-b-corp",
      "name": "Site B Corp",
      "domain": "site-b.local",
      "defaultLocale": "fr",
      "theme": "corporate",
      "createdAt": "2026-08-30T18:57:07.648Z",
      "updatedAt": "2026-08-30T18:57:07.648Z"
    },
    {
      "id": "f9df3338-b145-4f80-9bc0-5103c84b2d53",
      "slug": "northwind-analytics-demo",
      "name": "Northwind Analytics (demo)",
      "domain": "northwind.demo",
      "defaultLocale": "en",
      "theme": "default",
      "createdAt": "2026-08-30T22:43:28.446Z",
      "updatedAt": "2026-08-30T22:43:28.446Z"
    },
    {
      "id": "61ad1916-49f0-4671-b2f0-0a78b535f731",
      "slug": "default",
      "name": "kywi-marketing-v3",
      "domain": "kywi-marketing-production.up.railway.app",
      "defaultLocale": "en",
      "theme": "default",
      "createdAt": "2026-08-29T05:10:39.856Z",
      "updatedAt": "2026-08-29T05:10:39.856Z"
    },
    {
      "id": "1821c45b-27fa-4b9f-b70e-659650711133",
      "slug": "docs",
      "name": "Kywi Docs",
      "domain": "docs.kywi.dev",
      "defaultLocale": "en",
      "theme": "docs",
      "createdAt": "2026-09-02T05:04:10.047Z",
      "updatedAt": "2026-09-02T05:04:10.047Z"
    }
  ],
  "meta": { "total": 4, "page": 1, "pageSize": 4, "totalPages": 1, "hasMore": false }
}

What this adds over the already-public config list

GET /api/v1/config/sites is already unauthenticated, and already returns each CONFIGURED site's id, name, domain and defaultLocale — see discovering the content model at runtime. So the name and domain in the capture above are not new exposure. Neither, for a configured site, is the row's slug: the reconciliation step that creates each config site's database row sets its slug to the config's own id and matches the two on every later run, so a configured site's slug is just its config id restated. What GET /sites actually adds for a configured site is the DB id (a UUID, not the config id), its theme, and createdAt/updatedAt — which date each site's provisioning. The slug is new information only for a row no config site claims at all: site-b-corp in the capture above is exactly that, a database row with no matching entry in kywi.config.ts, so there is no config id for its slug to merely restate. Those UUIDs are the values every site-scoped route accepts as ?siteId=, so this route turns "guess a valid site scope" into "read one off a list."

What that does not grant

Knowing a site's id is not access to it. Every site-scoped route still authenticates and still runs assertSiteAccess against kywi_site_memberships on whichever site the request resolved to — an anonymous ?siteId= has exactly the same selecting power a Host header has, and selecting is not the same as reaching in. That still requires a real credential and a membership row, so treat the finding as "don't rely on a site id being secret," not as "this route grants access." See multi-site: the domain field and host-based resolution for how that resolution and those checks work.

Nothing throttles the request either

Core is not limiter-free — it throttles public form submissions, forgot-password requests and login attempts — but none of those limiters registers against this route. GET /sites and GET /sites/:siteId answer as fast as they are asked, same as every route core does not explicitly guard. Whatever limiting a deployment has for this route specifically is whatever the edge in front of it adds.

What an operator can do about it today

None of these is a Kywi feature; they are choices available at the edge or in how a deployment is set up:

Require a credential for anonymous callers. A reverse proxy or CDN rule in front of Kywi can require a credential on /api/v1/sites and /api/v1/sites/:siteId without touching anything else the API serves. Don't simply block the routes outright — the shipped admin reads them itself (site switching, site settings, search, users, the media pool) with a credential already attached, and an outright block would take the admin down along with the anonymous read.

Keep an unlaunched host out of domain. A site whose real domain has no DNS yet is still listed by name and id the moment it exists in kywi.config.ts. Putting a not-yet-public host in domainAliases only, until DNS is actually attached, is covered on the multi-site page above and limits what this route has to show for it.

Treat a site slug or UUID as public when naming things or writing internal documentation that assumes otherwise — an unauthenticated caller can already read both for every site on the deployment.