Skip to content

fix: remove self-referencing admin redirects#1598

Merged
bokelley merged 2 commits intomainfrom
bokelley/fix-admin-redirects
Mar 20, 2026
Merged

fix: remove self-referencing admin redirects#1598
bokelley merged 2 commits intomainfrom
bokelley/fix-admin-redirects

Conversation

@bokelley
Copy link
Contributor

Summary

  • Removed two pageRouter routes in accounts.ts that redirected /admin/accounts and /admin/accounts/:orgId back to themselves, causing infinite redirect loops
  • The actual page handlers in http.ts (with proper requireAuth + requireAdmin) were being shadowed by these earlier-registered routes
  • Added requireAdmin to the remaining /admin/organizations/:orgId redirect for defense-in-depth

Test plan

  • Visit /admin/accounts while authenticated as admin — page loads
  • Visit /admin/accounts/:orgId while authenticated as admin — page loads
  • Visit /admin/organizations/:orgId — redirects to /admin/accounts/:orgId
  • Visit any admin page as non-admin — gets 403

🤖 Generated with Claude Code

bokelley and others added 2 commits March 21, 2026 06:11
… loop

The pageRouter routes for /accounts and /accounts/:orgId were mounted at
/admin, making them redirect /admin/accounts → /admin/accounts (itself).
The actual page handlers in http.ts were shadowed by registration order.
Also adds requireAdmin to the /organizations/:orgId redirect.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bokelley bokelley merged commit 1b8dd5c into main Mar 20, 2026
9 checks passed
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