Repository navigation
fix: compare access groups as Keycloak group paths - #257
Merged
Merged
Conversation
|
📄 Docs preview for |
jbouder
requested changes
Nov 20, 2026
jbouder
left a comment
Contributor
There was a problem hiding this comment.
One blocker: the new path default needs an upgrade note. Two smaller fixes inline.
dcmcand
force-pushed
the
fix/232-group-paths
branch
from
November 20, 2026 13:35
eb9a4ee to
c988069
Compare
NIC's Keycloak puts full group paths in the groups claim (/llm), while the pack compared the bare names in access.groups exactly, so a NIC user in llm saw no models, the internal endpoint's group rule could not match, and usage was billed to team none. A new chart value, auth.oidc.groupsClaimForm (LLM_OIDC_GROUPS_CLAIM_FORM), says how the claim writes its values. In path form, the default, the key manager compares both sides as paths and the operator writes the gateway's allow-list as paths, so llm and /llm both name the top-level group; in name form values are compared as written, for a claim such as realm_access.roles. The admission webhooks reject a group that is blank or only slashes, since Envoy Gateway refuses a claim rule with no values. The usage collector names a team by its group's last path segment. The pack's own group mapper and the dev realm now emit paths, as NIC's realm does. Closes #232
The auditor compared a model's access groups with the userinfo groups exactly, so in path form a model's "llm" never matched the "/llm" Keycloak returns and a user still in the group would lose their key. NewAuditor now takes the group form and normalizes both sides, as the model watcher does. The key manager's NebariApp mapper hardcoded full.path "true", so with groupsClaimForm: name tokens still carried "/llm" and private models vanished from the key manager. full.path now follows groupsClaimForm. Add an upgrading entry for installs whose tokens carry plain group names: role claims set groupsClaimForm: name, and group mappers with full path off turn it on.
dcmcand
force-pushed
the
fix/232-group-paths
branch
from
November 20, 2026 13:56
c988069 to
9ff27e6
Compare
jbouder
approved these changes
Nov 20, 2026
jbouder
left a comment
Contributor
There was a problem hiding this comment.
All three addressed. LGTM.
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.
Closes #232
Problem
NIC's Keycloak puts full group paths in the token's
groupsclaim (/llm,/team-a). The pack compared the bare names inaccess.groupsexactly, so on a NIC cluster a user inllmsaw no models and couldn't create a key, the internal endpoint's group rule could never match, and the usage collector billed every request to teamnone.Change
A new chart value,
auth.oidc.groupsClaimForm(envLLM_OIDC_GROUPS_CLAIM_FORM), says how the groups claim writes its values:path(default): Keycloak group paths.llmand/llminaccess.groupsboth name the top-level groupllm; a nested group is written as its path (/org/llm). This matches how the nebari-operator treats NebariApp groups (NormalizeGroupPaths) and how the usage console already compares groups.name: values compared exactly as written, for a claim that is not a group path, such asrealm_access.roles. Normalizing a role to/opswould lock everyone out, so role setups set this.Per component:
FilterModelsForUsernormalizes the user's groups and the model's groups to the configured form before comparing. The normalizer isshared/oidcGroupForm.MinItems=1onJWTClaim.Values), so a model whose only group normalizes to nothing would otherwise get a SecurityPolicy the API server rejects./team-aand/org/team-abill toteam-a. Bare names behave as before.full.path: "true", as NIC's realm does.configuration.mdxdocuments the new value; the installation runbook and troubleshooting page explain the path form and nested groups.Two existing expectations change with the new default:
operator/.../auth_test.gonow expects the allow-list[/ml-team /platform], anddev/usage-forgery-check.shexpects the recorded groups to include/team-a.Testing
shared,key-manager,usage-console/server:go test ./...pass.operator:make test(envtest) passes.make test-usage-collectorpasses, with two new cases for path groups (API-key owner and a nested group in the verified token).helm lintpasses;helm templaterendersLLM_OIDC_GROUPS_CLAIM_FORMfor the operator and key manager, andfull.path: "true"on the SPA mapper.Dev end-to-end on a kind cluster (
make setup), with the dev realm now issuing group paths (alice's token carries["/llm-users","/team-a"]):dev/usage-forgery-check.sh: all checks pass. Alice's token gets 200 on the internal endpoint; a valid token with no groups gets 403 (rbac_access_denied_matched_policy[DENY]). The rendered SecurityPolicy for PassthroughModelmock-provider(access.groups: ["llm","llm-users"]) holds the claim values/llmand/llm-users.dev/usage-e2e.sh: passes. Alice and bob sign in with path-form tokens, see the model and create keys; usage is billed toteam-a(11 requests) andteam-b(7) in OpenMeter and the usage console.make test-auth: valid token 200, missing 401, garbage 401. The script also prints0: arithmetic syntax error in expression, which comes from the script and does not affect the result.make test-model-scope: all cases pass.Not run yet: a deploy on a NIC cluster, where NIC's realm-level groups mapper sits alongside the pack's client mapper.
Notes
shared/oidc, the operator (its image builds fromoperator/alone and cannot importshared), and the usage console's existinggroupPath.