Skip to content

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
onecli:mainfrom
Mohil-Ahuja:fix/gitlab-whoami-tool
Open

Mohil-Ahuja wants to merge 1 commit into
onecli:mainfrom
Mohil-Ahuja:fix/gitlab-whoami-tool

Conversation

@Mohil-Ahuja

Copy link
Copy Markdown

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/user on startup (glab, MCP servers, SDK token validators) failed even under a fully permissive grant.

Change

  • Add a read-only get_current_user tool mapping GET /api/v4/user. The path is exact (no wildcard), so per pathMatches it matches only /api/v4/user — never the user list (/api/v4/users) or user sub-resources (/api/v4/user/keys, /emails, /status).
  • Write side is unchanged: POST/PUT/PATCH/DELETE /api/v4/* stays under the write_all wildcard, so read/write separation holds.
  • Regenerated apps/gateway/crates/policy-engine/src/catalog.generated.json.
  • Added gitlab-path-scope.test.ts pinning that GET /api/v4/user resolves to get_current_user and nowhere wider.

Testing

pnpm --filter @onecli/api — all app-permissions tests pass, including the new regression test, the catalog-json drift check, and read-write-separation (151 relevant tests). tsc --noEmit and prettier are clean.

Fixes #570

…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
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Mohil-Ahuja

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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.

GitLab app: no tool covers GET /api/v4/user, so whoami is always blocked even with full access

1 participant