Skip to content

Commit ab1ff6d

Browse files
feat(worker): add env var to disable repo-driven permission syncing (#989)
* feat(backend): add env vars to independently enable/disable user and repo driven permission syncing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: update CHANGELOG for #989 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(backend): only allow repo-driven permission syncing to be disabled Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: add Azure DevOps Cloud and Server to permission syncing platform support table Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent fc90833 commit ab1ff6d

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111
- [EE] Added multi-owner support with promote/demote actions. [#988](https://github.com/sourcebot-dev/sourcebot/pull/988)
12+
- [EE] Added `PERMISSION_SYNC_REPO_DRIVEN_ENABLED` environment variable to enable/disable repo-driven permission syncing. [#989](https://github.com/sourcebot-dev/sourcebot/pull/989)
1213

1314
## [4.15.3] - 2026-03-10
1415

docs/docs/configuration/environment-variables.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ The following environment variables allow you to configure your Sourcebot deploy
4646
| `AUTH_EE_GCP_IAP_ENABLED` | `false` | <p>When enabled, allows Sourcebot to automatically register/login from a successful GCP IAP redirect</p> |
4747
| `AUTH_EE_GCP_IAP_AUDIENCE` | - | <p>The GCP IAP audience to use when verifying JWT tokens. Must be set to enable GCP IAP JIT provisioning</p> |
4848
| `EXPERIMENT_EE_PERMISSION_SYNC_ENABLED` | `false` | <p>Enables [permission syncing](/docs/features/permission-syncing).</p> |
49+
| `PERMISSION_SYNC_REPO_DRIVEN_ENABLED` | `true` | <p>Enables/disables [repo-driven permission syncing](/docs/features/permission-syncing#how-it-works). Only applies when `EXPERIMENT_EE_PERMISSION_SYNC_ENABLED` is `true`.</p> |
4950
| `AUTH_EE_ALLOW_EMAIL_ACCOUNT_LINKING` | `true` | <p>When enabled, different SSO accounts with the same email address will automatically be linked.</p> |
5051

5152

docs/docs/features/permission-syncing.mdx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ We are actively working on supporting more code hosts. If you'd like to see a sp
4141
| [GitLab (Self-managed & Cloud)](/docs/features/permission-syncing#gitlab) ||
4242
| [Bitbucket Cloud](/docs/features/permission-syncing#bitbucket-cloud) | 🟠 Partial |
4343
| [Bitbucket Data Center](/docs/features/permission-syncing#bitbucket-data-center) | 🟠 Partial |
44+
| Azure DevOps Cloud | 🛑 |
45+
| Azure DevOps Server | 🛑 |
4446
| Gitea | 🛑 |
4547
| Gerrit | 🛑 |
4648
| Generic git host | 🛑 |
@@ -134,7 +136,14 @@ Permission syncing works by periodically syncing ACLs from the code host(s) to S
134136
- **User driven** : fetches the list of all repositories that a given user has access to.
135137
- **Repo driven** : fetches the list of all users that have access to a given repository.
136138

137-
User driven and repo driven syncing occurs every 24 hours by default. These intervals can be configured using the following settings in the [config file](/docs/configuration/config-file):
139+
User driven and repo driven syncing occurs every 24 hours by default. Repo-driven syncing can be disabled independently using the following environment variable:
140+
141+
| Environment variable | Default | Description |
142+
|---|---|---|
143+
| `PERMISSION_SYNC_REPO_DRIVEN_ENABLED` | `true` | Enables/disables repo-driven syncing. |
144+
145+
The sync intervals can be configured using the following settings in the [config file](/docs/configuration/config-file):
146+
138147
| Setting | Type | Default | Minimum |
139148
|-------------------------------------------------|---------|------------|---------|
140149
| `experiment_repoDrivenPermissionSyncIntervalMs` | number | 24 hours | 1 |

packages/backend/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ if (env.EXPERIMENT_EE_PERMISSION_SYNC_ENABLED === 'true' && !hasEntitlement('per
7676
process.exit(1);
7777
}
7878
else if (env.EXPERIMENT_EE_PERMISSION_SYNC_ENABLED === 'true' && hasEntitlement('permission-syncing')) {
79-
repoPermissionSyncer.startScheduler();
79+
if (env.PERMISSION_SYNC_REPO_DRIVEN_ENABLED === 'true') {
80+
repoPermissionSyncer.startScheduler();
81+
}
8082
accountPermissionSyncer.startScheduler();
8183
}
8284

packages/shared/src/env.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ export const env = createEnv({
247247
// @NOTE: Take care to update actions.ts when changing the name of this.
248248
EXPERIMENT_SELF_SERVE_REPO_INDEXING_GITHUB_TOKEN: z.string().optional(),
249249
EXPERIMENT_EE_PERMISSION_SYNC_ENABLED: booleanSchema.default('false'),
250+
PERMISSION_SYNC_REPO_DRIVEN_ENABLED: booleanSchema.default('true'),
250251
EXPERIMENT_ASK_GH_ENABLED: booleanSchema.default('false'),
251252

252253
SOURCEBOT_ENCRYPTION_KEY: z.string(),

0 commit comments

Comments
 (0)