Return not found for OIDC org access errors

Map membership, profile, and inactive-user failures from
OpenOIDCChildSessionForOrganization to a generic 404 instead
of 500 so org-scoped OIDC callbacks do not reveal tenant
access details.

Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-06-18 09:12:47 +02:00
parent 2c8ae26ea1
commit 19d59a4d96

View File

@@ -171,6 +171,24 @@ func (h *OIDCHandler) CallbackHandler(w http.ResponseWriter, r *http.Request) {
if organizationID != nil {
_, _, err = h.iam.SessionService.OpenOIDCChildSessionForOrganization(ctx, rootSession.ID, *organizationID)
if err != nil {
if _, ok := errors.AsType[*iam.ErrMembershipNotFound](err); ok {
httpserver.RenderError(w, http.StatusNotFound, errors.New("not found"))
return
}
if _, ok := errors.AsType[*iam.ErrProfileNotFound](err); ok {
httpserver.RenderError(w, http.StatusNotFound, errors.New("not found"))
return
}
if _, ok := errors.AsType[*iam.ErrUserInactive](err); ok {
httpserver.RenderError(w, http.StatusNotFound, errors.New("not found"))
return
}
h.logger.ErrorCtx(ctx, "cannot open OIDC child session", log.Error(err))
httpserver.RenderError(w, http.StatusInternalServerError, errors.New("internal server error"))