Repository navigation
feat(integrations): agents act as the user on GitLab - #749
Merged
Merged
Conversation
Adds a gitlab provider to the unified OAuth engine over the deployment's GitLab OAuth app, act-as consent for gitlab, and the gitlab_user_token and gitlab_user_token_for tools sharing one concern with the GitHub pair. The profile's Connected accounts page shows both providers. Signed-off-by: Alex <[email protected]>
…for gitlab as a known provider Signed-off-by: Alex <[email protected]>
… credential factory Signed-off-by: Alex <[email protected]>
Signed-off-by: Alex <[email protected]>
Signed-off-by: Alex <[email protected]>
Signed-off-by: Alex <[email protected]>
Signed-off-by: Alex <[email protected]>
NOX73
commented
Nov 14, 2026
NOX73
commented
Nov 14, 2026
NOX73
commented
Nov 14, 2026
Revoke only current-host grants on disconnect, leave old-host grants to lapse, dispatch the latest connection through PROVIDERS, move identity onto OauthCredential, name the OAuth app and endpoints explicitly, stop refreshing early (R2), name the provider in accessible names, warn at the GitLab consent switches, and fix the GitLab guide. Signed-off-by: Alex <[email protected]>
…ta key Github/Gitlab::UserConnection read the key from OauthCredential::IDENTITY_FIELDS; move this PR's changelog entry to Unreleased. Signed-off-by: Alex <[email protected]>
NOX73
commented
Nov 14, 2026
…th engine revokes the grant Signed-off-by: Alex <[email protected]>
…ect test Signed-off-by: Alex <[email protected]>
Contributor
There was a problem hiding this comment.
Round 4 (head 4a5569d): the delta since 3fb59af matches Alex's decisions. Gitlab::UserTokenService now uses the gitlab gem, with the Bearer header covered by a test and gem errors mapped to the service's errors. Revocation moved into Oauth::TokenService.revoke!, which takes its endpoint from the registry and uses SafeHttp with the trusted host. No remarks.
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
Agents can act as the user on GitLab, as #214 does for GitHub (task #238, design
docs/design/gitlab-user-identity.md, PR #744).gitlabentry on the unified OAuth engine over the deployment's existing GitLab OAuth app. Endpoints and issuer followGITLAB_ENDPOINT(a resolver on the registry entry); the client id/secret use the app's own setting names; the operator's host is trusted for the token exchange and refresh forgitlabonly (a literal IP stays refused). Credentials on another host are invisible (gitlab_connections_offilters on the issuer).act_as_consents.provideracceptsgitlab(no migration).gitlab_user_tokenandgitlab_user_token_for. The nine shared steps move toInternalTools::Concerns::UserTokenContext; GitHub and GitLab each supply their part. GitHub messages are unchanged and its tests pass untouched. GitLab hands out the stored token, refreshed when under 30 minutes remain, reportsexpires_at10 minutes early, and checks Developer access per repository (falling back to the project member list for access that comes through a shared group); repositories the person cannot push to land inskipped.Not limited to the session's repositories: GitLab cannot narrow an OAuth token (design §2.1, decision D1 accepted).
Related issues
Task #238 (builds on #214).
Type of change
How was this tested?
On a Coder workspace at the pushed head:
Gitlab::UserTokenService), engine (providers, callback, private-host refresh), both tools, profile request tests, models; the GitHub tool tests pass unchanged.yarn tsc,yarn lint,yarn fsd, and the Connections page Vitest.rubocop,rails zeitwerk:check.Staging QA still to do (needs the redirect URI
https://staging.flow.aixle.com/oauth/callbackon the staging GitLab OAuth app): connect, push and merge request as the user, a user whose access to a repository comes only through a shared group, spike R2 (does a refresh revoke the previous access token).Checklist
git commit -s).[Unreleased]in CHANGELOG.md.