feat: add Azure DevOps Cloud user permission syncing
Adds user-driven repository permission syncing for Azure DevOps Cloud. Users sign in or link an Azure DevOps account through Microsoft Entra OAuth; Sourcebot uses their delegated token to verify code access before granting access to indexed private repositories.
- Adds the
azuredevopsidentity provider, encrypted token refresh, linked-account UI support, and scheduled/manual account syncing. The Entra app needs Azure DevOps delegated Code Read (vso.code) permission. - Checks root Git item metadata with bounded concurrency and cancellation. Inaccessible repositories receive no grant; organization-specific 401 responses do not remove verified access in other organizations. Transient errors prevent publishing an incomplete permission set.
- Preserves the organization in repository URLs when ADO omits
webUrl, and documents configuration and support limits.
This is Cloud-only and user-driven only. Empty repositories or repositories with an unreadable default revision receive no grant. Existing connection PATs continue to handle indexing.
Validation: 99 focused backend/web tests passed; schema, shared, and backend builds passed; configuration validation, targeted ESLint, and git diff --check passed. Full web type-checking reports errors in existing generated Next.js settings-page types. Live Entra/ADO OAuth verification has not been performed.
[!NOTE]
High Risk
Changes authorization and OAuth token handling for repository access; incorrect sync or URL validation could over-grant or wrongly revoke access, though the implementation is designed to fail closed on errors and avoid sending tokens to untrusted hosts.
Overview
Adds user-driven permission syncing for Azure DevOps Cloud so private indexed repos are granted only after a successful per-repo code read check with the user’s Entra-issued OAuth token (connection PATs still drive discovery/indexing).
Introduces the azuredevops identity provider (tenant-scoped Microsoft Entra OIDC, sso or account_linking), token refresh with the Azure DevOps resource scope, and wires sync into the account permission workload with fail-safe behavior: transient ADO errors keep the last grants, global token rejection clears grants and flags re-auth, and org-specific 401s do not strip access elsewhere. New getAzureDevOpsReadableRepoIds builds fixed dev.azure.com API calls from validated clone URLs (no token leakage to hostile hosts), handles throttling/empty repos, and avoids partial publishes.
Also fixes ADO repo compile URLs when webUrl is missing (preserve organization from remoteUrl), extends schemas/docs/changelog, login/linked-account UI branding and analytics, and marks ADO Cloud as user-driven only on the permission-sync matrix.
Reviewed by Cursor Bugbot for commit a703dd2e5ed5aa297c07018092bd04c07bc9182e. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Adds user-driven repository permission syncing for Azure DevOps Cloud. Users sign in or link an Azure DevOps account through Microsoft Entra OAuth, and Sourcebot verifies code access before granting access to indexed private repositories. This is Cloud-only and user-driven only; existing connection PATs continue to handle indexing.
New Features
- Adds the
azuredevopsidentity provider with encrypted token refresh, linked-account UI, and scheduled/manual account syncing. - Grants access only after a successful root Git item metadata read, with bounded concurrency and cancellation.
- Does not publish a partial permission set when an upstream request fails transiently.
- Clears cached grants when the token is globally rejected, but ignores organization-specific 401s from other orgs.
- Preserves the ADO organization in repository URLs when
webUrlis absent.
Migration
- Configure the
azuredevopsidentity provider withtenantId,clientId, andclientSecret. - The Entra app needs Azure DevOps delegated Code Read (
vso.code) permission. - Empty repositories and repos with an unreadable default revision receive no grant.
Summary by CodeRabbit
-
New Features
- Added Azure DevOps Cloud as an identity provider for SSO and account linking through Microsoft Entra.
- Added user-driven permission syncing for Azure DevOps Cloud repositories.
- Added support for tenant-specific OAuth configuration and Azure DevOps authentication.
- Added Azure DevOps Cloud configuration schemas and setup guidance.
-
Documentation
- Documented required permissions, supported account types, synchronization behavior, and configuration options.
- Clarified that Azure DevOps Server is not supported for permission syncing.