Repository navigation
fix: preserve raw claims for native Microsoft sign-in - #19
Merged
gn-kim-k merged 2 commits intoOct 20, 2026
Merged
Conversation
Replace the preserveRawClaims flag with the hunk from upstream ory/kratos 373a2e6 (feat: more extension points (ory#4272)), so that token_verifier.go matches upstream and a later rebase applies cleanly. Native Apple and Google verification now also return raw claims. Claude-Session: https://claude.ai/code/session_0172mHvWYKYpy7qvrugERAjV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Microsoft native
id_tokenverification currently decodes only the typedClaimsstruct. Provider-specific fields such asxms_edovare discarded, so Jsonnet mappers cannot readclaims.raw_claims.xms_edov, although the browser callback already exposes it.Port upstream ory/kratos 373a2e6 (
feat: more extension points (#4272)):verifyTokenalways decodes the verified token intoRawClaims, sotoken_verifier.gomatches upstream. Native Google and Apple verification now also return raw claims, as they do upstream.Related issue(s)
Reproduced with locally signed tokens: before this patch, the same token produces populated raw claims through the Microsoft browser path and
RawClaims: nilthrough native verification. The nine new raw-claim cases and the browser/native comparison fail before the fix and pass afterward.Validation
Executed with Go 1.26.1 on Linux arm64 (WSL), with SQLite/CGO:
go test -tags sqlite ./selfservice/strategy/oidc -run 'Test(MicrosoftVerify|MicrosoftClaims|GoogleVerify|AppleVerify)$' -count=1— passed.go test -tags sqlite -short ./selfservice/strategy/oidc -skip '^TestPostEndpointRedirect$' -count=1— passed.goimportson changed Go files andgit diff --check— passed.Coverage includes boolean/string/numeric and absent
xms_edov, JSON-serialized mapper input, browser/native parity withsubject_source: oid, Google/Apple raw claims, and rejection of expired tokens. Existing signature, audience, issuer, tenant, additional-audience and subject tests also pass.The initial broader run encountered Windows CRLF snapshot differences and a missing Docker socket. Unchanged snapshot files were normalized to LF locally (no snapshot diff).
TestPostEndpointRedirectrequires Hydra/Docker even in short mode and was explicitly excluded; other service-backed scenarios are skipped by short mode. Full integration tests were not run.Compatibility review
verifyTokencallers (Apple, Google, Microsoft): all now return raw claims. Native claims reach only the Jsonnet mapper input and the claim-key span attribute; nothing stores them.Checklist
Further Comments
This PR contains the decoder fix and tests only. Deployment and any repair of previously stored identity metadata are separate work.
https://claude.ai/code/session_0172mHvWYKYpy7qvrugERAjV