You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: enforce permissions for public repos and store issuerUrl on accounts (#993)
* feat: enforce permissions for public repos and store issuerUrl on accounts
- Adds enforcePermissionsForPublicRepos per-connection toggle
- Stores issuerUrl on Account at sign-in for public repo permission checks
- Updates getRepoPermissionFilterForUser to apply new public repo logic
- Cleans up sso.ts provider issuerUrl handling
- Updates permission syncing docs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore: update CHANGELOG for #993
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs
* lazy migration of issuerUrl
* supporting comments in the schema
* feedback
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
-[EE] Added `enforcePermissions` per-connection flag to control whether repository permissions are enforced for a given connection. Defaults to the value of `PERMISSION_SYNC_ENABLED`. [#991](https://github.com/sourcebot-dev/sourcebot/pull/991)
14
14
-[EE] Added `repoDrivenPermissionSyncIntervalMs` and `userDrivenPermissionSyncIntervalMs` config settings, deprecating the `experiment_` prefixed variants (still respected as fallbacks). [#991](https://github.com/sourcebot-dev/sourcebot/pull/991)
15
+
-[EE] Added `enforcePermissionsForPublicRepos` per-connection flag to restrict public repository visibility to users with a linked account for that connection's code host. [#993](https://github.com/sourcebot-dev/sourcebot/pull/993)
15
16
16
17
### Changed
17
18
-[EE] Promoted `PERMISSION_SYNC_ENABLED` as the canonical env var for enabling permission syncing, deprecating `EXPERIMENT_EE_PERMISSION_SYNC_ENABLED` (still respected as a fallback). [#991](https://github.com/sourcebot-dev/sourcebot/pull/991)
Copy file name to clipboardExpand all lines: docs/docs/features/permission-syncing.mdx
+18-11Lines changed: 18 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,9 +147,13 @@ The button will show a spinner while the sync is in progress and display a confi
147
147
148
148
# Overriding enforcement per connection
149
149
150
-
Each [connection](/docs/connections/overview) supports an `enforcePermissions` flag that controls whether permissions are enforced for repositories in that connection. This lets you mix code hosts in a single deployment - for example, enforcing access control on a private GitHub connection while keeping an internal Gerrit instance open to all users.
150
+
Each [connection](/docs/connections/overview) supports two flags that control permission enforcement for that connection's repositories:
151
151
152
-
By default, `enforcePermissions` inherits the value of `PERMISSION_SYNC_ENABLED`. You can override it per connection in the [config file](/docs/configuration/config-file):
152
+
-**`enforcePermissions`**: Controls whether repository permissions are enforced for the connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`.
153
+
-**`enforcePermissionsForPublicRepos`**: Controls whether repository permissions are enforced for public repositories in the connection. When true, public repositories are only visible to users with a linked account for the connection's code host. When false, public repositories are visible to all users. Has no effect when `enforcePermissions` is false. Defaults to false.
154
+
155
+
156
+
These flags are useful when you want different enforcement behavior across connections. For example, you may want to enforce permissions on an internal GitHub Enterprise connection while leaving a public-facing Gerrit mirror open to all users. Or, you can use `enforcePermissionsForPublicRepos` to restrict public repositories on a Bitbucket connection so that only users who have authenticated with that host can browse them.
153
157
154
158
```json
155
159
{
@@ -158,6 +162,11 @@ By default, `enforcePermissions` inherits the value of `PERMISSION_SYNC_ENABLED`
158
162
"type": "github",
159
163
"enforcePermissions": true
160
164
},
165
+
"my-bitbucket": {
166
+
"type": "bitbucket",
167
+
"enforcePermissions": true,
168
+
"enforcePermissionsForPublicRepos": true
169
+
},
161
170
"my-gerrit": {
162
171
"type": "gerrit",
163
172
"url": "https://gerrit.example.com",
@@ -167,16 +176,14 @@ By default, `enforcePermissions` inherits the value of `PERMISSION_SYNC_ENABLED`
167
176
}
168
177
```
169
178
170
-
Setting `enforcePermissions: false` on a connection makes all repositories from that connection accessible to any user, regardless of the global `PERMISSION_SYNC_ENABLED` setting.
171
-
172
-
The table below shows when permissions are enforced based on the combination of `PERMISSION_SYNC_ENABLED` and `enforcePermissions`:
179
+
The table below shows when permissions are enforced based on the combination of `PERMISSION_SYNC_ENABLED`, `enforcePermissions`, and `enforcePermissionsForPublicRepos`:
Copy file name to clipboardExpand all lines: docs/snippets/schemas/v3/azuredevops.schema.mdx
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,6 +193,11 @@
193
193
"enforcePermissions": {
194
194
"type": "boolean",
195
195
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
196
+
},
197
+
"enforcePermissionsForPublicRepos": {
198
+
"type": "boolean",
199
+
"default": false,
200
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
Copy file name to clipboardExpand all lines: docs/snippets/schemas/v3/bitbucket.schema.mdx
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -166,6 +166,11 @@
166
166
"enforcePermissions": {
167
167
"type": "boolean",
168
168
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
169
+
},
170
+
"enforcePermissionsForPublicRepos": {
171
+
"type": "boolean",
172
+
"default": false,
173
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
Copy file name to clipboardExpand all lines: docs/snippets/schemas/v3/connection.schema.mdx
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -209,6 +209,11 @@
209
209
"enforcePermissions": {
210
210
"type": "boolean",
211
211
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
212
+
},
213
+
"enforcePermissionsForPublicRepos": {
214
+
"type": "boolean",
215
+
"default": false,
216
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
212
217
}
213
218
},
214
219
"required": [
@@ -415,6 +420,11 @@
415
420
"enforcePermissions": {
416
421
"type": "boolean",
417
422
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
423
+
},
424
+
"enforcePermissionsForPublicRepos": {
425
+
"type": "boolean",
426
+
"default": false,
427
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
418
428
}
419
429
},
420
430
"required": [
@@ -574,6 +584,11 @@
574
584
"enforcePermissions": {
575
585
"type": "boolean",
576
586
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
587
+
},
588
+
"enforcePermissionsForPublicRepos": {
589
+
"type": "boolean",
590
+
"default": false,
591
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
577
592
}
578
593
},
579
594
"required": [
@@ -685,6 +700,11 @@
685
700
"enforcePermissions": {
686
701
"type": "boolean",
687
702
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
703
+
},
704
+
"enforcePermissionsForPublicRepos": {
705
+
"type": "boolean",
706
+
"default": false,
707
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
688
708
}
689
709
},
690
710
"required": [
@@ -859,6 +879,11 @@
859
879
"enforcePermissions": {
860
880
"type": "boolean",
861
881
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
882
+
},
883
+
"enforcePermissionsForPublicRepos": {
884
+
"type": "boolean",
885
+
"default": false,
886
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
862
887
}
863
888
},
864
889
"required": [
@@ -1071,6 +1096,11 @@
1071
1096
"enforcePermissions": {
1072
1097
"type": "boolean",
1073
1098
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
1099
+
},
1100
+
"enforcePermissionsForPublicRepos": {
1101
+
"type": "boolean",
1102
+
"default": false,
1103
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
1074
1104
}
1075
1105
},
1076
1106
"required": [
@@ -1144,6 +1174,11 @@
1144
1174
"enforcePermissions": {
1145
1175
"type": "boolean",
1146
1176
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
1177
+
},
1178
+
"enforcePermissionsForPublicRepos": {
1179
+
"type": "boolean",
1180
+
"default": false,
1181
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
Copy file name to clipboardExpand all lines: docs/snippets/schemas/v3/genericGitHost.schema.mdx
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,11 @@
64
64
"enforcePermissions": {
65
65
"type": "boolean",
66
66
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
67
+
},
68
+
"enforcePermissionsForPublicRepos": {
69
+
"type": "boolean",
70
+
"default": false,
71
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
Copy file name to clipboardExpand all lines: docs/snippets/schemas/v3/gerrit.schema.mdx
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,11 @@
104
104
"enforcePermissions": {
105
105
"type": "boolean",
106
106
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
107
+
},
108
+
"enforcePermissionsForPublicRepos": {
109
+
"type": "boolean",
110
+
"default": false,
111
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
Copy file name to clipboardExpand all lines: docs/snippets/schemas/v3/gitea.schema.mdx
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,6 +152,11 @@
152
152
"enforcePermissions": {
153
153
"type": "boolean",
154
154
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
155
+
},
156
+
"enforcePermissionsForPublicRepos": {
157
+
"type": "boolean",
158
+
"default": false,
159
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
Copy file name to clipboardExpand all lines: docs/snippets/schemas/v3/github.schema.mdx
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -205,6 +205,11 @@
205
205
"enforcePermissions": {
206
206
"type": "boolean",
207
207
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
208
+
},
209
+
"enforcePermissionsForPublicRepos": {
210
+
"type": "boolean",
211
+
"default": false,
212
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
Copy file name to clipboardExpand all lines: docs/snippets/schemas/v3/gitlab.schema.mdx
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -199,6 +199,11 @@
199
199
"enforcePermissions": {
200
200
"type": "boolean",
201
201
"description": "Controls whether repository permissions are enforced for this connection. When `PERMISSION_SYNC_ENABLED` is false, this setting has no effect. Defaults to the value of `PERMISSION_SYNC_ENABLED`. See https://docs.sourcebot.dev/docs/features/permission-syncing"
202
+
},
203
+
"enforcePermissionsForPublicRepos": {
204
+
"type": "boolean",
205
+
"default": false,
206
+
"description": "Controls whether repository permissions are enforced for public repositories in this connection. When true, public repositories are only visible to users with a linked account for this connection's code host. When false, public repositories are visible to all users. Has no effect when enforcePermissions is false. Defaults to false. See https://docs.sourcebot.dev/docs/features/permission-syncing"
0 commit comments