feat(scim): add GET /scim/v2/Users/{id} - #2671
Conversation
bfdaf08 to
edc69eb
Compare
edc69eb to
eb57a35
Compare
a66ea24 to
b353b6d
Compare
b353b6d to
78515b5
Compare
78515b5 to
f3d911f
Compare
f3d911f to
8f19172
Compare
189f978 to
5da63b3
Compare
7504838 to
b741d18
Compare
This comment has been minimized.
This comment has been minimized.
| return nil, false | ||
| } | ||
|
|
||
| if !provider.IsEnabled() { |
There was a problem hiding this comment.
⚪ Severity: LOW
The server returns HTTP 403 for a valid token whose provider is disabled, versus HTTP 401 for any unknown token. This status-code difference lets an attacker use a disabled SCIM provider as an oracle — submitting candidate tokens and distinguishing valid-but-forbidden ones (403) from invalid ones (401), effectively confirming token validity without gaining access.
Helpful? Add 👍 / 👎
💡 Fix Suggestion
Suggestion: Replace the HTTP 403 response for a disabled provider with the same unauthorized(w) call (HTTP 401) used for unknown tokens. This eliminates the status-code oracle by returning a uniform 401 response whether the token is unrecognised or resolves to a disabled provider, so an attacker can no longer confirm token validity by observing the response code.
⚠️ Experimental Feature: This code suggestion is automatically generated. Please review carefully.
| if !provider.IsEnabled() { | |
| if !provider.IsEnabled() { | |
| unauthorized(w) | |
| return nil, false | |
| } |
e354abc to
ca92147
Compare
d367afc to
8879494
Compare
8879494 to
97a60fc
Compare
97a60fc to
b66f29c
Compare
b66f29c to
2dc3da7
Compare
What kind of change does this PR introduce?
Feature. Adds
GET /scim/v2/Users/{id}, the first SCIM resource endpoint.https://linear.app/supabase/issue/AUTH-1368/scim-users-get-by-id
What is the current behavior?
/scim/v2serves the three discovery endpoints and nothing else.Before:
What is the new behavior?
scim.Server.Authenticateresolves the SSO provider that owns the presented bearer token and puts it on the request context.UserByIDthen returns that provider's user:200+ User resource,application/scim+json401+WWW-Authenticate: Bearer403404, identical bodyDiscovery stays unauthenticated.
Authenticateis scoped to the/Usersroute so a deployment with no provisioned tenant still serves/Schemas.After:
Additional context