Skip to content

Commit 24f897a

Browse files
StiensWoutclaude
andcommitted
fix(providers): refuse redirects for upstream Antigravity downloads
An upstream release is vouched for only by its Google download URL, so its download no longer follows a redirect to somewhere that check never saw. Pinned downloads stay hash-verified and unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 7b2df54 commit 24f897a

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎apps/server/src/provider/AntigravityInstallation.ts‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import * as Scope from "effect/Scope";
2020
import * as Semaphore from "effect/Semaphore";
2121
import * as Stream from "effect/Stream";
2222
import * as SubscriptionRef from "effect/SubscriptionRef";
23-
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
23+
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
2424
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
2525
import * as NodeCrypto from "node:crypto";
2626
import * as NodeFSP from "node:fs/promises";
@@ -675,9 +675,16 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
675675
let downloadedBytes = 0;
676676
let lastProgressAt = yield* Clock.currentTimeMillis;
677677
yield* Effect.gen(function* () {
678-
const response = yield* http
679-
.execute(HttpClientRequest.get(release.url))
680-
.pipe(Effect.flatMap(HttpClientResponse.filterStatusOk));
678+
const request = http.execute(HttpClientRequest.get(release.url));
679+
// Only its URL vouches for an upstream release, so a redirect is
680+
// refused rather than followed somewhere that check never saw.
681+
const response = yield* (
682+
pin
683+
? request
684+
: request.pipe(
685+
Effect.provideService(FetchHttpClient.RequestInit, { redirect: "error" }),
686+
)
687+
).pipe(Effect.flatMap(HttpClientResponse.filterStatusOk));
681688
// dl.google.com gzips the zip when the client accepts it, so
682689
// `content-length` is the encoded size. The decoded stream is still
683690
// checked against the byte limit and, when pinned, the hash below.

0 commit comments

Comments
 (0)