Skip to content

manage registered agents at /admin/agents - #443

Open
Jumongweb wants to merge 6 commits into
Bitcoindefi:mainfrom
Jumongweb:main
Open

manage registered agents at /admin/agents#443
Jumongweb wants to merge 6 commits into
Bitcoindefi:mainfrom
Jumongweb:main

Conversation

@Jumongweb

@Jumongweb Jumongweb commented Jul 16, 2026

Copy link
Copy Markdown

closes #197
This PR secures the admin agents registry flow end to end by enforcing ADMIN_TOKEN checks on the registry APIs, not just the admin page. It also updates the admin agents client to forward the validated token on all registry requests and adds regression tests for both authorized and unauthorized access.
What Changed
Added a shared admin-token helper in lib/admin-token.ts (line 1) to normalize accepted header names and validate against process.env.ADMIN_TOKEN.
Updated app/admin/agents/page.tsx (line 1) to reuse the shared validation logic and pass the validated token into the client component.
Updated components/admin/admin-agents-client.tsx (line 1) so all list, force-offline, and deregister requests include the admin token header.
Locked down app/api/registry/route.ts (line 1) and [app/api/registry/id]/route.ts (line 1) to return 403 Forbidden when the token is missing or invalid.
Expanded tests/api/registry/registry.test.ts (line 1) to cover successful authorized access plus unauthorized list, patch, and delete cases.

@sonarqubecloud

Copy link
Copy Markdown

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.

Notifications: in-app toast alerts for XP gains and quest completions

1 participant