Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(slugs): audit admin/multica/new/www + reserve in slug list (MUL-972) (#1359)
devv-evec0be1b7ce9ae
diff --git a/packages/core/paths/reserved-slugs.ts b/packages/core/paths/reserved-slugs.tsindex 5a28d9c523..fa5e739d41 100644--- a/packages/core/paths/reserved-slugs.ts+++ b/packages/core/paths/reserved-slugs.ts@@ -28,6 +28,9 @@ export const RESERVED_SLUGS = new Set([// Platform / marketing routes (current + likely-future)"api","admin",+ "multica", // brand name — prevent impersonation workspaces+ "www", // hostname confusable; never a legitimate workspace slug+ "new", // ambiguous verb-as-slug; reserved for future global create routes"help","about","pricing",diff --git a/server/internal/handler/workspace_reserved_slugs.go b/server/internal/handler/workspace_reserved_slugs.goindex 6bb075b64a..e859684bb8 100644--- a/server/internal/handler/workspace_reserved_slugs.go+++ b/server/internal/handler/workspace_reserved_slugs.go@@ -29,6 +29,9 @@ var reservedSlugs = map[string]bool{// Platform / marketing routes (current + likely-future)"api": true,"admin": true,+ "multica": true, // brand name — prevent impersonation workspaces+ "www": true, // hostname confusable; never a legitimate workspace slug+ "new": true, // ambiguous verb-as-slug; reserved for future global create routes"help": true,"about": true,"pricing": true,diff --git a/server/migrations/049_audit_legacy_reserved_slugs.down.sql b/server/migrations/049_audit_legacy_reserved_slugs.down.sqlnew file mode 100644index 0000000000..741a71ad5a--- /dev/null+++ b/server/migrations/049_audit_legacy_reserved_slugs.down.sql@@ -0,0 +1 @@+-- No-op: 049 is an audit-only migration. Nothing to roll back.diff --git a/server/migrations/049_audit_legacy_reserved_slugs.up.sql b/server/migrations/049_audit_legacy_reserved_slugs.up.sqlnew file mode 100644index 0000000000..f5270f5c56--- /dev/null+++ b/server/migrations/049_audit_legacy_reserved_slugs.up.sql@@ -0,0 +1,48 @@+-- Audit `admin`, `multica`, `new`, `www` against the workspace.slug column.+--+-- Follow-up to migration 047 (extended reserved slugs). 047 intentionally+-- omitted these four slugs from its audit because each had one conflicting+-- workspace in production at the time, and blocking deploy on owner outreach+-- was deemed unacceptable. MUL-972 closed that loop on prd:+--+-- * `admin` (99cd10e4-…) → renamed to `legacy-admin-99cd10e4`+-- * `multica` (dcd796aa-…) → renamed to `legacy-multica-dcd796aa`+-- * `new` (e391e3ed-…) → renamed to `legacy-new-e391e3ed`+-- * `www` (5e8d38b2-…) → workspace deleted (was empty: 0 issues /+-- projects / agents, owner-only member)+--+-- With the prd data clean, this migration promotes those four slugs into the+-- audit set so any future workspace that slips in with one of them fails+-- startup loudly instead of being silently shadowed by a global route.+--+-- `setup` is STILL omitted from this audit. The `setup` workspace+-- (b43f0bc2-…) is a real production user (Roberto Betancourth, building a+-- chants/Alabanzas app) and is being handled out-of-band via owner outreach+-- to negotiate a rename. A separate follow-up migration will fold `setup`+-- into the audit once that workspace's slug has been migrated.+--+-- Keep this slug list aligned with:+-- - server/internal/handler/workspace_reserved_slugs.go+-- - packages/core/paths/reserved-slugs.ts++DO $$+DECLARE+ conflict_count INT;+ conflict_list TEXT;+BEGIN+ SELECT+ COUNT(*),+ string_agg(slug, ', ' ORDER BY slug)+ INTO conflict_count, conflict_list+ FROM workspace+ WHERE slug IN (+ 'admin',+ 'multica',+ 'new',+ 'www'+ );++ IF conflict_count > 0 THEN+ RAISE EXCEPTION 'Found % workspace(s) with slugs that collide with the legacy reserved-slug audit set: %. Rename or delete before deploying (see MUL-972 for the playbook).', conflict_count, conflict_list;+ END IF;+END $$;