# Site-record public exposure: GET /sites is unauthenticated

URL: https://kywi-docs-production.up.railway.app/operating/site-record-public-exposure-get-sites-is-unauthenticated
Type: docPage

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.

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:

curl -s http://localhost:3700/api/v1/sites

## response — anonymous, 200

## 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](/integrating/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](/operating/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.
