[bug] GitHub App installation tokens (ghs_) are rejected by the credential preflight
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 48/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- github, typescript
- Domaine
- authentication, backend
Piste de recherche
Start in packages/backend/src/github.ts at getGitHubReposFromConfig and the GET /user preflight around lines 115 and 185; compare the existing token detection and authentication handling in github.ts and utils.ts:163-177. Check the existing GitHub token-type unit test and verify that a ghs_ token can discover repositories without the user-only preflight failing; consider the users: paths at lines 251 and 322 as additional scope.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
Sourcebot recognises GitHub App installation tokens as a supported token type —
GitHubTokenType declares 'app_installation' and detectGitHubTokenType() returns it
for the ghs_ prefix (packages/backend/src/github.ts:26,43), with a unit test asserting
exactly that.
However, a connector configured with one fails before listing a single repository.
getGitHubReposFromConfig validates the credential with GET /user (github.ts:185) and
rethrows on failure. An installation token authenticates as an installation, not a user,
so GitHub answers:
403 "Resource not accessible by integration"
No permission grant can satisfy this, because there is no user to return. The check also
cannot be skipped: its guard is isAuthenticated: !!token (github.ts:115), so the only
way to avoid it is to configure no token at all — which limits indexing to public
repositories.
Expected: a connector configured with an installation token indexes normally.
Actual: repository discovery aborts with a 403 at the preflight.
The inconsistency is the bug: every other GitHub path already handles installation
tokens correctly. getRepoAuth builds x-access-token: <token> git credentials from one
(utils.ts:163-177), which is precisely the documented form for installation tokens, and
repos.listForOrg accepts one. Only the preflight rejects it.
Note - The credential is simply an installation token supplied as an ordinary
connector token.
To reproduce
- Register a GitHub App, install it on an organisation, grant
Contents: readand
Metadata: read. - Mint an installation token:
POST /app/installations/{installation_id}/access_tokens(returns aghs_…token). - Configure a GitHub connector with that token and an
orgsentry:{ "type": "github", "token": { "env": "GITHUB_TOKEN" }, "orgs": ["my-org"] } - Start Sourcebot and trigger a connection sync.
Result: sync fails immediately. Logs show Failed to authenticate with GitHub and a 403
Resource not accessible by integration. Zero repositories are discovered.
Substituting a personal access token for the same organisation works, which isolates the
failure to the token type rather than to permissions or configuration.
Sourcebot deployment information
Sourcebot version (e.g. v3.0.1): v5.1.12 (docker.sourcebot.dev/sourcebot-dev/sourcebot),
also reproduced against main at the time of writing.
Additional information
Two further user-context calls exist in the same file and will fail the same way for the
same reason, though only when users: is configured rather than orgs::
repos.listForAuthenticatedUser→GET /user/repos(github.ts:251)rest.search.repos→GET /search/repositories?q=user:…(github.ts:322)
A fix for the preflight is proposed in the linked pull request. Happy to extend it to
those two paths if you would prefer them handled in the same change.
- Langage dominant
- TypeScript
- Étoiles
- 3.9k
- Forks
- 374
- Merge moyen
- 2 j 21 h
- PR mergées (30 j)
- 43
Préparer son environnement
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de sourcebot-dev/sourcebot
-
[bug] Search result hydration performs duplicate repository lookups within the same chunkPeut-être à nouveau libre @Abhishek-Sonje l’a pris il y a 19 jours, et aucune pull request n’est ouverte. Ouvertebug triage needed
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
sourcebot-dev/sourcebot#1681 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Linux ctags build instructions in CONTRIBUTING.md are missing build dependenciesPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
sourcebot-dev/sourcebot#1633 ·
Les mainteneurs répondent en général sous 1 jour
-
MCP ask_codebase rejects explicit languageModel: getLanguageModelKey includes displayName which the MCP schema doesn't exposePeut-être à nouveau libre @Harsh23Kashyap l’a pris il y a 102 jours, et aucune pull request n’est ouverte. Ouverteask_sb bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
sourcebot-dev/sourcebot#1137 · 4 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
[FR] Support file-based and Azure Key Vault token sources alongside env and googleCloudSecretPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 64/100
sourcebot-dev/sourcebot#1704 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
[bug] Local repositories with a space or non-ASCII character in the path cannot be indexedPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 35/100
sourcebot-dev/sourcebot#1689 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de sourcebot-dev/sourcebot
Issues similaires
-
nextjs-tracking
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
cloudflare/vinext#3887 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
apache/rocketmq-dashboard#6331 ·
Les mainteneurs répondent en général sous 5 jours
-
bug cache clinical-safety P1-critical
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
juspay/blend-design-system#1788 ·
Les mainteneurs répondent en général sous 1 jour
-
[Analytics] Add Focus Time-Block Efficiency Ratio Calculator in src/lib/focus/efficiency-ratio.tsOuverteanalytics beginner friendly community contributions-welcome enhancement good first issue hacktoberfest help wanted up-for-grabs
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour