Skip to content

Commit aac1d45

Browse files
authored
Add anonymous access option to core (#385)
* migrate anonymous access logic out of ee * add anonymous access toggle * handle anon toggle properly based on perms * add forceEnableAnonymousAccess setting * add docs for access settings * change forceEnableAnonymousAccess to be an env var * add FORCE_ENABLE_ANONYMOUS_ACCESS to list in docs * add back the enablePublicAccess setting as deprecated * add changelog entry * fix build errors * add news entry for anonymous access * feedback
1 parent 55c8e41 commit aac1d45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+633
-379
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
### Changed
1111
- Fixed typos in UI, docs, code [#369](https://github.com/sourcebot-dev/sourcebot/pull/369)
12+
- Add anonymous access option to core and deprecate the `enablePublicAccess` config setting. [#385](https://github.com/sourcebot-dev/sourcebot/pull/385)
1213

1314
## [4.5.1] - 2025-07-14
1415

demo-site-config.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@
238238
}
239239
},
240240
"settings": {
241-
"reindexIntervalMs": 86400000, // 24 hours
242-
"enablePublicAccess": true
241+
"reindexIntervalMs": 86400000 // 24 hours
243242
}
244243
}

docs/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"pages": [
7474
"docs/configuration/auth/overview",
7575
"docs/configuration/auth/providers",
76-
"docs/configuration/auth/inviting-members",
76+
"docs/configuration/auth/access-settings",
7777
"docs/configuration/auth/roles-and-permissions",
7878
"docs/configuration/auth/faq"
7979
]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Access Settings
3+
sidebarTitle: Access settings
4+
---
5+
6+
There are various settings to control how users access your Sourcebot deployment.
7+
8+
# Anonymous access
9+
10+
<Note>Anonymous access cannot be enabled if you have an enterprise license. If you have any questions about this restriction [reach out to us](https://www.sourcebot.dev/contact).</Note>
11+
12+
By default, your Sourcebot deployment is gated with a login page. If you'd like users to access the deployment anonymously, you can enable anonymous access.
13+
14+
This can be enabled by navigating to **Settings -> Access** or by setting the `FORCE_ENABLE_ANONYMOUS_ACCESS` environment variable.
15+
16+
When accessing Sourcebot anonymously, a user's permissions are limited to that of the [Guest](/docs/configuration/auth/roles-and-permissions) role.
17+
18+
# Member Approval
19+
20+
By default, Sourcebot requires new members to be approved by the owner of the deployment. This section explains how approvals work and how
21+
to configure this behavior.
22+
23+
### Configuration
24+
Member approval can be configured by the owner of the deployment by navigating to **Settings -> Members**:
25+
26+
![Member Approval Toggle](/images/member_approval_toggle.png)
27+
28+
### Managing Requests
29+
30+
If member approval is enabled, new members will be asked to submit a join request after signing up. They will not have access to the Sourcebot deployment
31+
until this request is approved by the owner.
32+
33+
The owner can see and manage all pending join requests by navigating to **Settings -> Members**.
34+
35+
## Invite link
36+
37+
If member approval is required, an owner of the deployment can enable an invite link. When enabled, users
38+
can use this invite link to register and be automatically added to the organization without approval:
39+
40+
![Invite Link Toggle](/images/invite_link_toggle.png)

docs/docs/configuration/auth/inviting-members.mdx

Lines changed: 0 additions & 30 deletions
This file was deleted.

docs/docs/configuration/auth/roles-and-permissions.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ Each member has a role which defines their permissions within an organization:
1010
| Role | Permission |
1111
| :--- | :--------- |
1212
| `Owner` | Each organization has a single `Owner`. This user has full access rights, including: connection management, organization management, and inviting new members. |
13-
| `Member` | Read-only access to the organization. A `Member` can search across the repos indexed by an organization's connections, but may not manage the organization or its connections. |
13+
| `Member` | Read-only access to the organization. A `Member` can search across the repos indexed by an organization's connections, as well as view the organizations configuration and member list. However, they cannot modify this configuration or invite new members. |
14+
| `Guest` | When accessing Sourcebot [anonymously](/docs/configuration/auth/access-settings#anonymous-access), a user has the `Guest` role. `Guest`'s can search across repos indexed by an organization's connections, but cannot view any information regarding the organizations configuration or members. |

docs/docs/configuration/environment-variables.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The following environment variables allow you to configure your Sourcebot deploy
2121
| `DATABASE_DATA_DIR` | `$DATA_CACHE_DIR/db` | <p>The data directory for the default Postgres database.</p> |
2222
| `DATABASE_URL` | `postgresql://postgres@ localhost:5432/sourcebot` | <p>Connection string of your Postgres database. By default, a Postgres database is automatically provisioned at startup within the container.</p><p>If you'd like to use a non-default schema, you can provide it as a parameter in the database url </p> |
2323
| `EMAIL_FROM_ADDRESS` | `-` | <p>The email address that transactional emails will be sent from. See [this doc](/docs/configuration/transactional-emails) for more info.</p> |
24+
| `FORCE_ENABLE_ANONYMOUS_ACCESS` | `false` | <p>When enabled, [anonymous access](/docs/configuration/auth/access-settings#anonymous-access) to the organization will always be enabled</p>
2425
| `REDIS_DATA_DIR` | `$DATA_CACHE_DIR/redis` | <p>The data directory for the default Redis instance.</p> |
2526
| `REDIS_URL` | `redis://localhost:6379` | <p>Connection string of your Redis instance. By default, a Redis database is automatically provisioned at startup within the container.</p> |
2627
| `REDIS_REMOVE_ON_COMPLETE` | `0` | <p>Controls how many completed jobs are allowed to remain in Redis queues</p> |

docs/docs/deployment-guide.mdx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,6 @@ import SupportedPlatforms from '/snippets/platform-support.mdx'
77
The following guide will walk you through the steps to deploy Sourcebot on your own infrastructure. Sourcebot is distributed as a [single docker container](/docs/overview#architecture) that can be deployed to a k8s cluster, a VM, or any platform that supports docker.
88

99

10-
## Walkthrough video
11-
---
12-
13-
Watch this quick walkthrough video to learn how to deploy Sourcebot using Docker.
14-
15-
<iframe
16-
src="https://youtube.com/embed/TPQh0z7Qcjg"
17-
title="YouTube video player"
18-
frameborder="0"
19-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
20-
allowfullscreen
21-
className="aspect-video w-full"
22-
></iframe>
23-
24-
## Step-by-step guide
25-
---
26-
2710
<Note>Hit an issue? Please let us know on [GitHub discussions](https://github.com/sourcebot-dev/sourcebot/discussions/categories/support) or by [emailing us](mailto:[email protected]).</Note>
2811

2912
<Steps>

docs/snippets/schemas/v3/index.schema.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@
6666
},
6767
"enablePublicAccess": {
6868
"type": "boolean",
69-
"description": "[Sourcebot EE] When enabled, allows unauthenticated users to access Sourcebot. Requires an enterprise license with an unlimited number of seats.",
69+
"deprecated": true,
70+
"description": "This setting is deprecated. Please use the `FORCE_ENABLE_ANONYMOUS_ACCESS` environment variable instead.",
7071
"default": false
7172
}
7273
},
@@ -180,7 +181,8 @@
180181
},
181182
"enablePublicAccess": {
182183
"type": "boolean",
183-
"description": "[Sourcebot EE] When enabled, allows unauthenticated users to access Sourcebot. Requires an enterprise license with an unlimited number of seats.",
184+
"deprecated": true,
185+
"description": "This setting is deprecated. Please use the `FORCE_ENABLE_ANONYMOUS_ACCESS` environment variable instead.",
184186
"default": false
185187
}
186188
},

packages/backend/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ export const DEFAULT_SETTINGS: Settings = {
1515
maxRepoGarbageCollectionJobConcurrency: 8,
1616
repoGarbageCollectionGracePeriodMs: 10 * 1000, // 10 seconds
1717
repoIndexTimeoutMs: 1000 * 60 * 60 * 2, // 2 hours
18-
enablePublicAccess: false,
18+
enablePublicAccess: false // deprected, use FORCE_ENABLE_ANONYMOUS_ACCESS instead
1919
}

0 commit comments

Comments
 (0)