manage registered agents at /admin/agents - #443
Open
Jumongweb wants to merge 6 commits into
Open
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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.