Unified · Split
| @@ -245,20 +245,9 @@ const appRegistrationErrorToDiagnostic = (error: unknown): SyncDiagnostic => { · 244 unmodified lines | ||
| 245 | 245 | const tokenItemId = (slug: string): ProviderItemId => |
| 246 | 246 | ProviderItemId.make(`apps/source-tokens/${slug}`); |
| 247 | 247 | |
| 248 | −const gitHubConnectionToken = (ctx: PluginCtx<AppsStore>): Effect.Effect<string | null, unknown> => | |
| 249 | − Effect.gen(function* () { | |
| 250 | − const connections = yield* ctx.connections.list({ | |
| 251 | − integration: IntegrationSlug.make("github"), | |
| 252 | − }); | |
| 253 | − const connection = connections.find((item) => item.owner === "user") ?? connections[0]; | |
| 254 | − if (!connection) return null; | |
| 255 | − return yield* ctx.connections.resolveValue({ | |
| 256 | − owner: connection.owner, | |
| 257 | − integration: connection.integration, | |
| 258 | − name: connection.name, | |
| 259 | − }); | |
| 260 | − }); | |
| 261 | − | |
| 248 | +// A source authenticates only with its own explicitly provided token. No | |
| 249 | +// implicit credential sharing: a stored GitHub connection must never leak | |
| 250 | +// into git fetches the user did not tie to it. | |
| 262 | 251 | const gitTokenFor = ( |
| 263 | 252 | ctx: PluginCtx<AppsStore>, |
| 264 | 253 | config: Extract<AppSourceConfig, { readonly kind: "git" }>, |
| @@ -270,9 +259,7 @@ const gitTokenFor = ( · 5 unmodified lines | ||
| 270 | 259 | ProviderItemId.make(config.tokenItemId), |
| 271 | 260 | ); |
| 272 | 261 | } |
| 273 | − const url = yield* parseGitSourceUrl(config.url).pipe(Effect.result); | |
| 274 | − if (Result.isFailure(url) || url.success.hostname.toLowerCase() !== "github.com") return null; | |
| 275 | − return yield* gitHubConnectionToken(ctx); | |
| 262 | + return null; | |
| 276 | 263 | }); |
| 277 | 264 | |
| 278 | 265 | const activeToolNamesFor = ( |