DEV Community

StarkMan
StarkMan

Posted on

Sourcegraph code-host connections hold more authority than a search page

Sourcegraph code-host connections hold more authority than a search page

A code search page can look like a convenient developer tool. Behind it, Sourcegraph stores code-host connections, syncs repositories and often handles tokens that can read private source. The authority sits in the configuration, not in the first search box.

Sourcegraph connects to code hosts to index repositories and synchronize permissions. The GitHub integration documentation distinguishes app, token and repository visibility choices. The GraphQL API is available for administration and integration. Site administrators can create access tokens with the site-admin:sudo scope, which allows the holder to act as another user.

That combination creates two review tracks. One track covers who can administer source-code connections. The other covers who can use tokens and GraphQL to read code or change permission data.

Measurement scope

The fixed queries were app="Sourcegraph", title="Sourcegraph" and http.body="Sourcegraph".

On 2026-11-24, a standalone ZoomEye SDK batch used sub_type="all", page 1 and page size 1. All three selected queries failed before a response with ConnectionError and Windows error 10013. No count was returned. These failures are not zero matches and do not establish product exposure.

The unsuccessful batch is not a zero-exposure result. It is also not evidence that any indexed page exposes source. A Sourcegraph login page, a documentation mirror and an internal code search service may share a title while having very different access controls.

Review connection authority

Inventory each code-host connection by host, organization and repository set. Confirm whether the token or app installation can read all repositories or only the intended ones. Record the owner and rotation process for each credential.

Review permission syncing. Sourcegraph can inherit repository permissions from the code host or use an explicit permissions API. Confirm which model the deployment uses and test a user who should not see a private repository. A search result from that user is a stronger finding than an exposed login page.

Restrict site-admin:sudo. If an integration needs it, isolate the token, record the business reason and review its use in GraphQL logs. Remove tokens for departed users and stale automation. Prefer user-scoped tokens for normal API calls.

Place the site-admin configuration and GraphQL endpoint behind a controlled network path. Require strong authentication and limit who can create access tokens. Review external-service changes because a new code host can add repositories and credentials outside the normal application inventory.

Build the evidence

Choose one indexed repository and trace who can search it. Compare the Sourcegraph user, code-host permission and token scope. Review logs for GraphQL calls that changed external services or impersonated another user.

The external product query helps locate candidate instances. The decision depends on code-host token scope, repository permission sync and API administration.

References

Top comments (0)