Skip to content

fix(okta): honour search and filter expressions on GET /api/v1/groups - #228

Closed
0xChathurinda wants to merge 1 commit into
vercel-labs:mainfrom
0xChathurinda:fix/okta-group-search
Closed

fix(okta): honour search and filter expressions on GET /api/v1/groups#228
0xChathurinda wants to merge 1 commit into
vercel-labs:mainfrom
0xChathurinda:fix/okta-group-search

Conversation

@0xChathurinda

Copy link
Copy Markdown

Summary

GET /api/v1/groups only narrowed on q. Okta's documented search parameter (profile.name eq "Everyone", profile.name sw "app_" and type eq "OKTA_GROUP") and filter were ignored, so a client that looks a group up by exact name got the first page of every group back and, if it takes the first result, the wrong group.

This adds a small evaluator (src/search.ts) for the SCIM-style expressions Okta accepts on this endpoint:

  • attributes: id, type, profile.name, profile.description, created, lastUpdated, lastMembershipUpdated
  • operators: eq, ne, sw, co, pr, combined with and
  • an expression it cannot evaluate returns Okta's 400 E0000031 The search filter is invalid instead of an unfiltered page

q keeps working and composes with search/filter.

Why

The Okta SDKs and most hand-written clients find a group by name with search=profile.name eq "…". Against the emulator that call returned everything, which is a silent wrong answer rather than an error.

Testing

src/__tests__/group-search.test.ts covers exact match, and, filter, the empty result, q composition, the 400 path, and the parser's operators and rejections. pnpm --filter @emulators/okta test, type-check and lint pass. Package README and the web docs page mention the parameters.

The groups list only narrowed on `q`; `search=profile.name eq "Everyone"`
was ignored and returned the first page of every group, so a client looking
a group up by exact name silently got the wrong one. Both `search` and
`filter` now evaluate the SCIM-style expressions Okta documents for this
endpoint: id, type, profile.name, profile.description, created,
lastUpdated and lastMembershipUpdated with eq, ne, sw, co and pr, joined by
`and`. An expression the evaluator does not understand is a 400 E0000031,
as on Okta, rather than an unfiltered page that looks like a match.
@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

@0xChathurinda is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@0xChathurinda
0xChathurinda deleted the fix/okta-group-search branch September 7, 2026 02:00
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