Repository navigation
Conversation
The /graph/v1.0/me endpoint reported the internal user UUID as identities[].issuerAssignedId instead of the OIDC sub. The fast path built the user model from the CS3 context user, which does not carry the external identity. /me now always resolves the user through the identity backend; group memberships are still only expanded on $expand=memberOf. Forward-port of owncloud#12411 to master. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Julian Koberg <[email protected]>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
@kobergj should we backport it? |
DeepDiver1975
left a comment
There was a problem hiding this comment.
Reviewed as a forward-port of #12411. The fix is correct and well-scoped. 👍
Correctness
The root cause is accurate: the old fast path identity.CreateUserModelFromCS3(u) builds the model from the CS3 context user, which sets Identities[0].IssuerAssignedId = u.GetId().OpaqueId (the internal UUID) because the CS3 user carries no external identity. Routing /me through g.identityBackend.GetUser(...) fixes this for the LDAP backend (the default): createUserModelFromLDAP reads the oCExternalIdentity attribute and populates Identities with the real OIDC issuer + sub. The LDAP path also returns a strictly richer model than the fast path (DisplayName, Mail, OnPremisesSamAccountName, Id, GivenName, Surname, AccountEnabled, ExternalID, UserType, SignInActivity), so no non-identity field regresses.
The memberOf empty-slice initialization is correctly preserved (if slices.Contains(exp, "memberOf") && me.MemberOf == nil), and the lazy expansion of group memberships is retained — the extra cost on a plain /me is a single user lookup, as the description states.
Security
The backend lookup uses u.GetId().GetOpaqueId() from the authenticated request context, i.e. the caller's own id — no cross-user resolution and no info leak. The change actually removes fabricated identity data. No concern here.
Note on the CS3 identity backend
For deployments configured with the CS3 backend (not the default), CS3.GetUser ends in CreateUserModelFromCS3(res.GetUser()) — the same conversion — so issuerAssignedId will still be the internal UUID there. The fix is effective for LDAP (the relevant/default deployment) and is harmless for CS3, so this is fine; just flagging that the bug is only resolved on the LDAP backend.
One edge case worth a look (non-blocking)
For an LDAP user that has no oCExternalIdentity stored (e.g. a purely local / non-OIDC-provisioned user), createUserModelFromLDAP only sets Identities when len(identities) > 0, so /me will now return an empty/absent identities array where the old fast path always returned a single (UUID-bearing) identity. This is arguably more correct — we stop fabricating an identity — but it is a visible behavior change for non-federated users and isn't covered by a test. Could you confirm this is intended and ideally add a regression spec for the "no external identity" case (asserting identities is empty rather than a fabricated UUID entry)? If the previous always-one-identity shape is relied upon by any client, this would be a subtle break.
Tests / changelog
Good: the new spec asserts issuerAssignedId == "the-oidc-sub" from the backend on a plain /me, and the appRoleAssignments spec was updated to stub GetUser (now always called). Changelog fragment present and follows the calens convention.
LGTM modulo confirming the empty-identities edge case above.
) fix(graph): [OCISDEV-751] return correct issuerAssignedId on /me (#12431) The /graph/v1.0/me endpoint reported the internal user UUID as identities[].issuerAssignedId instead of the OIDC sub. The fast path built the user model from the CS3 context user, which does not carry the external identity. /me now always resolves the user through the identity backend; group memberships are still only expanded on $expand=memberOf. Forward-port of #12411 to master. (cherry picked from commit 9f72d77) Signed-off-by: Julian Koberg <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]>
Description
Forward-port of #12411 (merged to
stable-8.1) tomaster.The
/graph/v1.0/meendpoint reported the internal user UUID asidentities[].issuerAssignedIdinstead of the issuer-assigned identity (the OIDCsub).GetMetook a fast path that built the user model from the CS3 user in the request context (CreateUserModelFromCS3). The CS3 user does not carry the external identity, so it fell back to settingIssuerAssignedIdto the internal user UUID. The correct value (the OIDCsub) is stored in the identity backend'soCExternalIdentityattribute at provisioning time and was only read back when$expand=memberOfwas requested (forcing the LDAP code path)./menow always resolves the user through the identity backend, which returns the correct identity. Group memberships are still only expanded — and thus only queried — when$expand=memberOfis requested, so the added cost on a plain/meis a single user lookup.Related Issue
OCISDEV-751
Motivation and Context
OIDC-federated clients (e.g. the EOSC / open-science-cloud deployment) use
identities[0].issuerAssignedIdas the user'sOC-Credentialfor pre-signed download URLs. Because the field returned the internal UUID, the credential lookup failed and downloads prompted for credentials.How Has This Been Tested?
go build ./services/graph/...go test ./services/graph/pkg/service/v0/(GetMe specs, including a regression assertion thatissuerAssignedIdequals the backend-provided sub on a plain/me)Types of changes
Checklist
🤖 Generated with Claude Code