Repository navigation
feat: recognize GitLab token types and their reach when resolving repositories - #3
Merged
Merged
Conversation
Classify each access token at setup (project, group, service account or personal) and store the type, the project or group id and its path on the identity, with a new migration for the columns. Project and group tokens are told by the bot user name GitLab gives them; any other bot user is a service account, whose name its creator may choose, and a human user holds a personal token. Identities stored before get classified lazily on first load. ResolveRepository skips connections whose token cannot cover the repository, requires at least the Developer role so a public project is never bound to a non-member token, and explains what each connection covers (or that its role is too low) when none qualifies. The hint no longer names only group access tokens, which GitLab.com offers on Premium and above. MintCredential refuses writes to non-members too. The display name now says what a connection covers, e.g. "Project token · acme/ui" or "Service account · <name>".
Extend the fake GitLab with project and group bot users, /groups/:id and per-token roles on /projects/:id, and test classification (including service accounts with a chosen name), display names, candidate filtering and ordering, lazy classification of existing rows, a token whose role on its own repository is too low, the error text for a service account, and the refusal of writes at access level 0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 28, 2026
pikann
approved these changes
Oct 29, 2026
pikann
left a comment
There was a problem hiding this comment.
LGTM! Thank you for the contribution! 🚀
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 #2
What
Classifies each access token at setup (project, group, service account or personal) and uses what it covers when resolving repositories.
CompleteIdentitySetupstorestoken_type,resource_idandresource_path. Project and group tokens are told by the bot user name GitLab gives them (project_<id>_bot…,group_<id>_bot…) and the path is looked up viaGET /projects/:idorGET /groups/:id(if the lookup fails the type is kept and the path stays empty). Any other bot user is a service account (its name may be chosen by its creator, so it is told by GitLab'sbotflag); a human user holds a personal token.identityOfsetsDisplayName: "Project token · acme/ui", "Group token · acme/frontend", "Service account · ", "Personal token · ".ResolveRepositoryskips a project token whose project doesn't match and a group token whose path doesn't contain the repo, then requiresaccess_level >= Developer, so a public repo is never bound to a non-member token. When every connection is skipped, the error says what each one covers (or that its role is too low) and asks for a token that is a member of the repository.MintCredentialnow also refusesAccessWriteat access level 0.Migration
New
0003_identity_token_reach.sqladds the three columns, leaving existing rows empty.0002is untouched. If you'd rather fold it into0002(v0.6.0 is not released yet), say so and I'll change it.Verification
/groups/:idand per-token roles.Notes
NotFound/ForbiddenfromResolveRepositoryto a genericErrNotVisible. The generic UI text is acceptable; surfacing the detail would need a core change, which is out of scope here.🤖 Generated with Claude Code