Repository navigation
fix(registry): honor caller auth on /api/registry/operator - #2934
Merged
Merged
Conversation
The operator lookup endpoint was hardcoding visibility==='public' and never reading the Authorization header, so authenticated members could not see members_only agents and owning orgs could not see their own private agents. - Accept WorkOS Bearer API key or session cookie (optAuth + inline key check; optionalAuth bails on API keys per middleware/auth.ts:1332). - Resolve caller org from apiKey.organizationId or users.primary_organization_id. - Include members_only when caller's org has API-access tier. - Include private when caller's org owns the queried profile.
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.
Summary
GET /api/registry/operatornow respects the Authorization header. Previously it hardcodedvisibility === 'public'and ignored Bearer API keys, so authenticated members never sawmembers_onlyagents and owning orgs never saw their ownprivateagents.optionalAuthskips API keys permiddleware/auth.ts:1332) or session cookie.apiKey.organizationIdorusers.primary_organization_id.members_onlyagents when the caller's org has API-access tier (Professional+), matching the pattern from/registry/agentsadded in 6471537.privateagents when the caller's org owns the queried profile (matched viaworkos_organization_id).Test plan
npm run typechecknpm run test:unit(631/631 passed)/api/registry/operator?domain=scope3.comwith no auth → only public agents