Skip to content

fix: remove administrative file listing entry points - #54

Merged
xiongxz merged 8 commits into
mainfrom
codex/admin-list-privacy
Nov 24, 2026
Merged

xiongxz merged 8 commits into
mainfrom
codex/admin-list-privacy

Conversation

@xiongxz

@xiongxz xiongxz commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Administrators could enumerate unrelated sites through the Sites page, authorization search, tenant details and global audit responses. This removes those discovery paths and provides audited forms for acting on a site whose address or ID is already known.

Entry point Result
/admin/sites / GET /api/admin/sites Page removed (404); catalog API retired (410) for every credential and filter
Administration → Site actions Exact address/slug/ID lookup with a reason; assignment, take-down, restoration, deletion and recovery use stable site-ID routes
Authorization resource selector Lists owned sites and site-admin grants assigned directly to the user; group/platform/tenant roles do not expand discovery
GET /api/tenants/:id Workspace governance events, including user sharing defaults; no site collection or site-targeted audit events
System → Action log Up to 200 scoped entries; audited site-history reads; reason-free existing-user and known-system filters; maintenance refreshes only the unfiltered log

Global audit views expose non-site events and the signed-in administrator's own site actions. Both database stores default to scope: "visible"; omitted scope/viewer values cannot expose all history. Full site history requires an explicit all scope after authorization, including the owner's existing activity endpoint. A site-ID audit query requires a valid reason and records site.audit.read before returning history. Unknown IDs, slugs and sites without a valid reason receive the same 404 response, preventing existence probing or silent partial results. Existing users and the defined system targets are recognized independently of ID prefixes. Maintenance does not replay earlier site queries or reasons.

Known-site forms work with email administrator sessions when PUBLISH_API_TOKEN is unset; personal tokens do not inherit these rights. Lookup returns metadata without content or credentials. Deep paths, app-relative paths under a mount and /v/<token> links identify one site; collections require an individual site's address. Full URLs must match the origin/mount, and decoded paths use safeRelativePath. Revoked/expired share links intentionally remain historical report identifiers under independent management authorization and auditing; they never restore share access.

Authorization exact lookup gives the same 404 for unknown, deleted, disabled-workspace and unauthorized targets. Elevated management/operator lookups record site.management; ordinary owner/site-admin lookups record site.lookup. Group site-admin grants still authorize exact management but do not populate the selector. Editing an independent lookup preserves the dropdown selection.

The console uses /api/admin/sites/by-id/<site-id> and its /owner route; legacy slug APIs share the handlers. All three mutation handlers bound request bodies to 4096 bytes. Reasons are normalized and validated before changing state, including NUL rejection; restore/undelete retain optional reasons and shared administrative validation preserves readable error messages. Assignment records ownership and its reason atomically, reserves space for the recipient suffix within 500 characters, keeps the stored reason on one line and rejects excess text without truncation.

Compatibility changes are documented in CHANGELOG, SELFHOST and the MCP operator guide:

  • Owner assignment requires { email, reason }; email-only scripts receive 400.
  • Missing targets on legacy slug PATCH/DELETE routes now return 404 {error: "Site not found"}, replacing 400 with No such site (take-down/delete) or The site is not deleted (undelete). Existing-site state errors remain 400.
  • Exact audit filters reject unresolved IDs/slugs with 404 instead of returning empty or partial history.

Aggregate statistics and stored audit records remain intact. Obsolete catalog helpers, styles, translations and the unused administrative download component mode are removed.

Validation on 4153aa49:

  • Regression tests reproduced the affected API behavior and the browser's system-target reason requirement before the fixes.
  • Full unit suite: 2,501 passed; 411 environment-gated tests skipped.
  • PostgreSQL: 16 store integration tests and 653 business tests passed; 8 native-archive-gated tests skipped locally.
  • Seven production-server browser regressions passed: known-site management/recovery, authorization management, scoped/exact history and maintenance behavior, reason-free user/system filters, independent dropdown selection, and retired catalog/page behavior.
  • CLI: 181 passed on Node 24.
  • Typecheck, lint, production build, README links and commit-message checks passed.
  • GitHub Actions CI and DCO passed on this commit, including runtime-image browser flows, multi-architecture builds and subpath deployment checks.

Signed-off-by: xiongxz <xiuzhang.xiong@lexmount.com>
Signed-off-by: xiongxz <xiuzhang.xiong@lexmount.com>
Comment thread src/app/api/admin/sites/route.ts Resolved
Comment thread src/app/admin/page.tsx Resolved
Comment thread src/app/api/tenants/[tenantId]/route.ts Resolved
Comment thread src/app/admin/system/page.tsx Resolved
Comment thread src/lib/authorization.ts Resolved
Comment thread src/lib/authorization.ts Resolved
Comment thread src/app/api/admin/sites/_shape.ts Resolved
Comment thread src/app/api/admin/sites/route.ts Resolved
Signed-off-by: xiongxz <xiuzhang.xiong@lexmount.com>
Comment thread src/lib/authorization.ts Resolved
Comment thread src/app/admin/page.tsx Resolved
Comment thread src/app/admin/site-actions/page.tsx Resolved
Comment thread src/lib/known-site.ts Resolved
Comment thread src/lib/authorization.ts Resolved
Comment thread src/app/admin/site-actions/page.tsx Resolved
Comment thread src/lib/admin.ts Resolved
Comment thread src/app/admin/site-actions/page.tsx Resolved
Signed-off-by: xiongxz <xiuzhang.xiong@lexmount.com>
Comment thread src/lib/authorization.ts Resolved
Comment thread src/lib/admin.ts Resolved
Comment thread src/lib/known-site.ts Resolved
Comment thread src/lib/authorization.ts Resolved
Comment thread src/app/admin/system/page.tsx Resolved
Comment thread src/lib/admin.ts Resolved
Comment thread src/app/api/admin/site-lookup/route.ts Resolved
Signed-off-by: xiongxz <xiuzhang.xiong@lexmount.com>
Comment thread src/lib/authorization.ts Resolved
Comment thread src/app/api/admin/sites/_mutations.ts Resolved
Comment thread src/app/admin/system/page.tsx Resolved
Comment thread src/app/api/admin/log/route.ts Resolved
Comment thread src/app/admin/system/page.tsx Resolved
Comment thread src/app/api/tenants/[tenantId]/route.ts Resolved
Comment thread src/lib/db-postgres.ts Resolved
Comment thread src/lib/known-site.ts Resolved
Comment thread src/lib/admin.ts Resolved
Comment thread src/lib/authorization.ts Resolved
Signed-off-by: xiongxz <xiuzhang.xiong@lexmount.com>
Comment thread src/lib/admin.ts Resolved
Comment thread src/lib/admin.ts Resolved
Comment thread src/lib/management-reason.ts Resolved
Comment thread src/app/api/admin/log/route.ts Resolved
Comment thread src/app/api/admin/sites/_mutations.ts Resolved
Comment thread src/app/api/admin/sites/_mutations.ts Resolved
Comment thread src/lib/known-site.ts Resolved
Comment thread src/lib/authorization.ts Resolved
Comment thread src/app/admin/sites/page.tsx Resolved
Signed-off-by: xiongxz <xiuzhang.xiong@lexmount.com>
Signed-off-by: xiongxz <xiuzhang.xiong@lexmount.com>
@xiongxz
xiongxz merged commit 5cc646a into main Nov 24, 2026
5 checks passed
@xiongxz
xiongxz deleted the codex/admin-list-privacy branch November 24, 2026 10:20
@xiongxz xiongxz mentioned this pull request Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant