Skip to content

feat(scim): render SCIM errors in RFC 7644 form - #2661

Open
xlgmokha wants to merge 1 commit into
xlgmokha/auth-1362bfrom
xlgmokha/auth-1362c
Open

feat(scim): render SCIM errors in RFC 7644 form#2661
xlgmokha wants to merge 1 commit into
xlgmokha/auth-1362bfrom
xlgmokha/auth-1362c

Conversation

@xlgmokha

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Feature. Adds the RFC-7644 error form and returns it from the SCIM endpoints, so failures under /scim/v2 answer in the shape a SCIM client expects.

Extracted from: #2643

What is the current behavior?

Nothing under /scim/v2 produces a SCIM error. The discovery endpoints return a bare 501 with an empty body, an unknown path under /scim/v2 falls to a plaintext 404, and a POST to a discovery endpoint gets a plaintext 405.

What is the new behavior?

Adds the error message form from RFC-7644 and renders it as application/scim+json.
Handlers can now send a SCIM error by returning one.

  • GET /scim/v2/Unknown -> 404 in SCIM form
  • POST|PUT|PATCH|DELETE on a discovery endpoints -> 405 in SCIM form, with Allow: GET
  • The three discovery endpoints still return 501, now with a SCIM body rather than an empty one

Example:

$ curl -i http://localhost:9999/scim/v2/Unknown
HTTP/1.1 404 Not Found
Content-Type: application/scim+json

{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:Error"
  ],
  "detail": "Endpoint or resource does not exist",
  "status": "404"
}

With GOTRUE_EXPERIMENTAL_SCIM_ENABLED unset, the routes still answer with the ordinary 404 (feature_disabled) rather than a SCIM error.

Additional context

@xlgmokha
xlgmokha changed the base branch from master to xlgmokha/auth-1362b July 30, 2026 22:38
Add the error message form from RFC 7644, and teach `HandleResponseError`
to render it, so a handler under `/scim/v2` can answer with a SCIM
error by returning one.

The router grows `NotFound` and `MethodNotAllowed` hooks. The SCIM
server uses them to answer an unknown endpoint with a 404 and an
unsupported method with a 405 carrying an Allow header, and the
not-implemented stubs return the same form instead of an empty body.

Errors are served as `application/scim+json`. With the flag off the
routes still answer with the ordinary 404.
@xlgmokha
xlgmokha force-pushed the xlgmokha/auth-1362c branch from 9a55516 to f36851b Compare July 30, 2026 22:44
@xlgmokha xlgmokha self-assigned this Jul 30, 2026
@xlgmokha
xlgmokha marked this pull request as ready for review July 30, 2026 22:51
@xlgmokha
xlgmokha requested a review from a team as a code owner July 30, 2026 22:51
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