fix(worker): Fix permission syncing for internal GitLab projects#857
fix(worker): Fix permission syncing for internal GitLab projects#857brendan-kellam merged 4 commits intomainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
|
Caution Review failedThe pull request is closed. WalkthroughPermission-syncing and visibility handling for GitLab were changed: the sync now fetches only private projects (no internal), the GitLab API call no longer sets Changes
Sequence Diagram(s)sequenceDiagram
participant Syncer as PermissionSyncer
participant GitLab as GitLab API
participant Store as RepoStore
participant Compiler as RepoCompileUtils
Syncer->>GitLab: GET projects (visibility=private, perPage=100)
GitLab-->>Syncer: returns private projects list
Syncer->>Store: persist/compute project IDs for permission sync
Store->>Compiler: request visibility evaluation for repos
Compiler-->>Store: visibility (treat internal as public)
Store-->>Syncer: finalized permission-enforced repo set
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
1 similar comment
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@CHANGELOG.md`:
- Around line 10-11: Typo fix: locate the changelog entry line starting with "-
[EE] Fixed issue where internal GitLab projects were not visibile in Sourcebot
when permission syncing is enabled.
[`#857`](https://github.com/sourcebot-dev/sourcebot/pull/857)" and correct the
misspelled word "visibile" to "visible" so the line reads "...projects were not
visible in Sourcebot...".
In `@packages/backend/src/repoCompileUtils.ts`:
- Around line 173-179: The current logic sets const isPublic =
project.visibility === 'public' || project.visibility === 'internal', which
treats GitLab "internal" repos as public and bypasses permission filtering;
change this by making isPublic true only for project.visibility === 'public' and
add a separate isInternal flag (e.g., const isInternal = project.visibility ===
'internal') so downstream permission checks use isPublic to skip filtering but
still apply or explicitly handle permission syncing/filters for isInternal
repos; update any code paths that currently rely on isPublic (permission
syncing/skipping logic) to account for isInternal and restore GitLab-internal
access enforcement or implement syncing for internal repos.
Internal GitLab projects were not visible in Sourcebot when permission syncing was enabled. This was because of two reasons:
membershipfilter totrue, meaning for a given user, we were not getting internal projects they were not a member of./projects/:id/members/allto fetch what users have access to a given project. This breaks down in the same way where if the project has internal visibility, then this api won't return users who are not members but should be able to see the project. I was poking around, and it seems like there is no mechanism of listing everything for internal projects.This PR removes permission enforcement for internal GitLab projects by setting the
isPublicflag totruefor internal (& public) projects. Internal projects are visible to everyone in the instance anyways, so enforcement on the Sourcebot side doesn't make much sense.Summary by CodeRabbit
Bug Fixes
Documentation