Skip to content

fix(graph): [OCISDEV-751] return correct issuerAssignedId on /me - #12431

Merged
2403905 merged 1 commit into
owncloud:masterfrom
kobergj:fix/OCISDEV-751-issuerassignedid-on-me-master
Jul 23, 2026
Merged

2403905 merged 1 commit into
owncloud:masterfrom
kobergj:fix/OCISDEV-751-issuerassignedid-on-me-master

Conversation

@kobergj

@kobergj kobergj commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Description

Forward-port of #12411 (merged to stable-8.1) to master.

The /graph/v1.0/me endpoint reported the internal user UUID as identities[].issuerAssignedId instead of the issuer-assigned identity (the OIDC sub).

GetMe took 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 setting IssuerAssignedId to the internal user UUID. The correct value (the OIDC sub) is stored in the identity backend's oCExternalIdentity attribute at provisioning time and was only read back when $expand=memberOf was requested (forcing the LDAP code path).

/me now 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=memberOf is requested, so the added cost on a plain /me is 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].issuerAssignedId as the user's OC-Credential for 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 that issuerAssignedId equals the backend-provided sub on a plain /me)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Code changes
  • Unit tests added
  • Changelog item

🤖 Generated with Claude Code

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]>
@kw-security

kw-security commented Jun 15, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@2403905

2403905 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@kobergj should we backport it?

@DeepDiver1975 DeepDiver1975 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@2403905
2403905 merged commit 9f72d77 into owncloud:master Jul 23, 2026
59 checks passed
mklos-kw pushed a commit that referenced this pull request Aug 6, 2026
)

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]>
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.

4 participants