Repository navigation
fix(gitlab): cover GET /api/v4/user with a read tool so whoami isn't blocked - #626
Open
Mohil-Ahuja wants to merge 1 commit into
Open
Mohil-Ahuja wants to merge 1 commit into
Mohil-Ahuja wants to merge 1 commit into
Conversation
…blocked The GitLab permission catalog had no tool matching `GET /api/v4/user`, so token-validation / whoami calls fell into the connection grant's always-blocked "everything else" fallback. Clients that hit `/api/v4/user` on startup (glab, MCP servers, SDK validators) failed even under a fully permissive grant. Add a read-only `get_current_user` tool mapping `GET /api/v4/user` (exact path, so it never widens to the user list or user sub-resources). The write side is unchanged: POST/PUT/PATCH/DELETE on `/api/v4/*` stays under the `write_all` wildcard, so read/write separation holds. Regenerated the gateway catalog JSON and added a regression test pinning that `GET /api/v4/user` resolves to `get_current_user` and nowhere wider. Fixes onecli#570
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
Summary
The GitLab permission catalog had no tool matching
GET /api/v4/user, so token-validation / whoami calls fell into the connection grant's always-blocked "everything else" fallback. Clients that call/api/v4/useron startup (glab, MCP servers, SDK token validators) failed even under a fully permissive grant.Change
get_current_usertool mappingGET /api/v4/user. The path is exact (no wildcard), so perpathMatchesit matches only/api/v4/user— never the user list (/api/v4/users) or user sub-resources (/api/v4/user/keys,/emails,/status).POST/PUT/PATCH/DELETE /api/v4/*stays under thewrite_allwildcard, so read/write separation holds.apps/gateway/crates/policy-engine/src/catalog.generated.json.gitlab-path-scope.test.tspinning thatGET /api/v4/userresolves toget_current_userand nowhere wider.Testing
pnpm --filter @onecli/api— all app-permissions tests pass, including the new regression test, thecatalog-jsondrift check, andread-write-separation(151 relevant tests).tsc --noEmitand prettier are clean.Fixes #570