Skip to content

fix(registry): honor caller auth on /api/registry/operator - #2934

Merged
EmmaLouise2018 merged 1 commit into
mainfrom
EmmaLouise2018/registry-operator-agents
Apr 23, 2026
Merged

EmmaLouise2018 merged 1 commit into
mainfrom
EmmaLouise2018/registry-operator-agents

Conversation

@EmmaLouise2018

Copy link
Copy Markdown
Contributor

Summary

  • GET /api/registry/operator now respects the Authorization header. Previously it hardcoded visibility === 'public' and ignored Bearer API keys, so authenticated members never saw members_only agents and owning orgs never saw their own private agents.
  • Accepts WorkOS Bearer API key (inline-validated, since optionalAuth skips API keys per middleware/auth.ts:1332) or session cookie.
  • Resolves caller org from apiKey.organizationId or users.primary_organization_id.
  • Includes members_only agents when the caller's org has API-access tier (Professional+), matching the pattern from /registry/agents added in 6471537.
  • Includes private agents when the caller's org owns the queried profile (matched via workos_organization_id).

Test plan

  • npm run typecheck
  • npm run test:unit (631/631 passed)
  • Hit /api/registry/operator?domain=scope3.com with no auth → only public agents
  • Hit with Professional+ Bearer API key → public + members_only agents
  • Hit with API key owning the scope3 profile → public + members_only + private agents

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.
@EmmaLouise2018
EmmaLouise2018 merged commit a360a5f into main Apr 23, 2026
11 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