Skip to content

refactor(proxy): Use jmespath to extract claim values#2558

Open
rhafer wants to merge 1 commit intoopencloud-eu:mainfrom
rhafer:claim-extract-jmespath
Open

refactor(proxy): Use jmespath to extract claim values#2558
rhafer wants to merge 1 commit intoopencloud-eu:mainfrom
rhafer:claim-extract-jmespath

Conversation

@rhafer
Copy link
Copy Markdown
Member

@rhafer rhafer commented Apr 1, 2026

Replace the custom dot-path walking implementation (SplitWithEscaping + WalkSegments) in the proxy service's JWT middleware with github.com/jmespath-community/go-jmespath. extractRoles in oidcroles.go and readUserIDClaim in account_resolver.go now uses jmespath.Search()

NOTE: This change is backwards-incompatible for some corner cases. While simple dot-separated paths like 'realm_access.roles' are unchanged, claim paths containing literal dots (i.e. where the dot does not indicate a hierarchy) must now be quoted ('"sub.roles"' instead of 'sub.roles').

@rhafer rhafer requested a review from micbar April 1, 2026 10:16
@rhafer rhafer self-assigned this Apr 1, 2026
@rhafer rhafer added Type:Maintenance E.g. technical debt, packaging, etc. Type:Breaking-Change labels Apr 1, 2026
@rhafer rhafer force-pushed the claim-extract-jmespath branch 2 times, most recently from fee1d1c to 91641c6 Compare April 1, 2026 11:34
@rhafer rhafer force-pushed the claim-extract-jmespath branch from 91641c6 to 01f5f0d Compare April 15, 2026 07:30
Replace the custom dot-path walking implementation (SplitWithEscaping +
WalkSegments) in the proxy service's JWT middleware with
github.com/jmespath-community/go-jmespath. extractRoles in oidcroles.go
and readUserIDClaim in account_resolver.go now uses jmespath.Search()

NOTE: This change is backwards-incompatible for some corner cases. While
simple dot-separated paths like 'realm_access.roles' are unchanged,
claim paths containing literal dots (i.e. where the dot does not
indicate a hierarchy) must now be quoted ('"sub.roles"' instead of
'sub\.roles').
@rhafer rhafer force-pushed the claim-extract-jmespath branch from 01f5f0d to 74dc6f8 Compare April 15, 2026 08:38
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type:Breaking-Change Type:Maintenance E.g. technical debt, packaging, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant