[FR] Support file-based and Azure Key Vault token sources alongside env and googleCloudSecret
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #1705 di @simmi-tdh — chiusa senza merge
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 64/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- azure, typescript
Direzione di ricerca
Start with schemas/v3/shared.json and packages/shared/src/crypto.ts:124-149, then inspect the existing env and googleCloudSecret handling. Update the schema, regenerated schemas, implementation, unit tests, and docs/docs/configuration/config-file.mdx for both file and Azure Key Vault sources. Done means both configurations validate, missing or empty files fail clearly, and values are resolved on each use.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the feature you'd like
Add two new token sources alongside env and googleCloudSecret: a file source and an
Azure Key Vault source.
{ "token": { "file": "/var/run/secrets/sourcebot/github-token" } }
{ "token": { "azureKeyVaultSecret": "https://<vault>.vault.azure.net/secrets/<name>[/<version>]" } }
Motivation
A Token in the config can only come from an environment variable or from Google Cloud
Secret Manager. schemas/v3/shared.json defines exactly two shapes, { "env": ... } and
{ "googleCloudSecret": ... }, and getTokenFromConfig throws Invalid token configuration
for anything else (packages/shared/src/crypto.ts:124-149).
That makes short-lived credentials impractical outside GCP. GitHub App installation tokens
(ghs_, accepted as connection tokens once #1662 lands) expire after one hour. Environment
variables are fixed when the container starts, so the only way to hand Sourcebot a fresh
token is to restart the whole service every hour. That restart takes the web app down and
interrupts in-flight indexing.
The rest of the code already supports rotation. Nothing caches the resolved value:
getGitHubReposFromConfig calls getTokenFromConfig on every sync
(packages/backend/src/github.ts:172), and getRepoAuth calls it on every clone and fetch
(packages/backend/src/utils.ts:167). A source whose value can change at runtime would be
picked up on the next sync with no other changes. Only the source types are missing.
Note - this is not specific to GitHub. Token is shared, so connection tokens, SSO client
secrets, LLM API keys and environmentOverrides values (DATABASE_URL, REDIS_URL) have the
same limit. On Azure there is currently no supported way to keep any of them in Key Vault.
Proposed design
Both are additive anyOf branches in Token, so existing configs are unaffected.
1. file (no new dependencies)
{ "token": { "file": "/var/run/secrets/sourcebot/github-token" } }
- Read the file each time the token is resolved and trim whitespace, matching
envand
googleCloudSecret. Fail with a clear error if it is missing or empty. - Works on any platform: Kubernetes Secret volumes (refreshed in place), Docker/Compose
secrets, the Secrets Store CSI driver for Azure Key Vault/AWS/Vault, and sidecars that mint
tokens, such as a GitHub App token refresher writing to a sharedemptyDir. - On its own, this solves the rotation problem above.
2. azureKeyVaultSecret
{ "token": { "azureKeyVaultSecret": "https://<vault>.vault.azure.net/secrets/<name>" } }
{ "token": { "azureKeyVaultSecret": "https://<vault>.vault.azure.net/secrets/<name>/<version>" } }
- Uses
@azure/keyvault-secretswithDefaultAzureCredential(@azure/identity), covering
AKS Workload Identity, managed identity andAZURE_CLIENT_*environment variables. This
mirrors how the GCP source relies on Application Default Credentials. - Leaving out the version fetches the latest one, so rotating the secret in Key Vault is
enough.
Example use case
- Register a GitHub App, install it on an organisation, grant
Contents: readand
Metadata: read. - Run a sidecar (or CronJob) that mints an installation token every ~50 minutes via
POST /app/installations/{installation_id}/access_tokensand writes it to a shared volume. - Point the connector at that file:
{ "type": "github", "token": { "file": "/var/run/secrets/github-token" }, "orgs": ["my-org"] } - Sourcebot reads the current token on every sync, clone and fetch. No restarts.
Today, step 3 is rejected by schema validation at startup, and the env equivalent stops
working with 401 Bad credentials after an hour.
Alternatives considered
- Restarting the container every hour: causes downtime and interrupts indexing.
- The native
appsGitHub App integration: requires a license key, and itsprivateKey
is itself aToken(schemas/v3/app.json), so on Azure the App's private key still has to
sit in an environment variable. - Going through GCP Secret Manager: brings a second cloud into an Azure-only deployment.
Additional information
Sourcebot version: v5.1.12 (docker.sourcebot.dev/sourcebot-dev/sourcebot), also applies to
main at the time of writing. Running on AKS (Azure); no GCP.
I'm happy to send the PR: schemas/v3/shared.json (plus regenerated schemas and docs),
getTokenFromConfig, unit tests, and the Tokens section of
docs/docs/configuration/config-file.mdx. If you'd prefer it smaller, I can send file
first and Azure Key Vault in a follow-up.
- Lingua principale
- TypeScript
- Stelle
- 3.9k
- Fork
- 374
- Merge medio
- 2g 13h
- PR unite (30g)
- 48
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sourcebot-dev/sourcebot
-
[bug] Search result hydration performs duplicate repository lookups within the same chunkForse già presa @dipeshbabu l’ha presa 16 giorni fa. Apertabug triage needed
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
sourcebot-dev/sourcebot#1681 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Linux ctags build instructions in CONTRIBUTING.md are missing build dependenciesForse già presa @The-AarushiSingh l’ha presa 22 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
sourcebot-dev/sourcebot#1633 ·
I maintainer di solito rispondono entro 1 giorno
-
MCP ask_codebase rejects explicit languageModel: getLanguageModelKey includes displayName which the MCP schema doesn't exposeForse già presa @pranav718 l’ha presa 40 giorni fa. Apertaask_sb bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
sourcebot-dev/sourcebot#1137 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[bug] Local repositories with a space or non-ASCII character in the path cannot be indexedForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
sourcebot-dev/sourcebot#1689 ·
I maintainer di solito rispondono entro 1 giorno
-
[bug] Escaped quotes in a quoted keyword search are searched with the backslashesForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
sourcebot-dev/sourcebot#1687 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di sourcebot-dev/sourcebot
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
yjh051108/dsh-routing-suite#216 ·
-
kind/bug priority/needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Dependencies view: `getParent` loops forever on untitled documents, extension host runs out of memoryForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue
Difficoltà 2/5 Mezza giornata Idoneità per principianti 66/100
apache/fineract-consumer-facing#175 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 82/100
awslabs/visual-asset-management-system#413 ·
I maintainer di solito rispondono entro 1 giorno