Skip to content

Commit 63aca68

Browse files
fix(semble): increase archive download limit (#1306)
1 parent afdede5 commit 63aca68

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎src/services/code-index/semble/__tests__/semble-downloader.spec.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ import {
9797
downloadSemble,
9898
getSembleBinaryPath,
9999
SEMBLE_SHA256,
100+
SEMBLE_MAX_ARCHIVE_BYTES,
100101
} from "../semble-downloader"
101102
import * as https from "https"
102103
import { spawn } from "child_process"
@@ -111,6 +112,12 @@ describe("SEMBLE_SHA256 checksum fixture", () => {
111112
})
112113
})
113114

115+
describe("Semble archive download limit", () => {
116+
it("allows 100 MiB for future release growth", () => {
117+
expect(SEMBLE_MAX_ARCHIVE_BYTES).toBe(100 * 1024 * 1024)
118+
})
119+
})
120+
114121
describe("semble-downloader", () => {
115122
beforeEach(() => {
116123
clearAllMocks()

‎src/services/code-index/semble/semble-downloader.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ const SEMBLE_ARCHIVES: Record<string, { archive: string; binary: string }> = {
2626
export const SEMBLE_VERSION = "v0.4.1"
2727
const DOWNLOAD_BASE_URL = `https://github.com/Zoo-Code-Org/sembleexec/releases/download/${SEMBLE_VERSION}`
2828
const VERSION_FILE = ".semble-version"
29-
const MAX_ARCHIVE_BYTES = 50 * 1024 * 1024
29+
// Leave room for future release growth while still rejecting anomalous downloads.
30+
export const SEMBLE_MAX_ARCHIVE_BYTES = 100 * 1024 * 1024
3031

3132
/**
3233
* SHA-256 checksums for each platform archive at SEMBLE_VERSION.
@@ -122,7 +123,7 @@ export async function downloadSemble(storageDir: string): Promise<string | undef
122123
name: "Semble",
123124
trustedDomains: TRUSTED_DOWNLOAD_DOMAINS,
124125
timeoutMs: 120_000,
125-
maxBytes: MAX_ARCHIVE_BYTES,
126+
maxBytes: SEMBLE_MAX_ARCHIVE_BYTES,
126127
}),
127128
verifyArchive: (archivePath) => verifyChecksum(archivePath, expectedChecksum),
128129
extractArchive: async (archivePath, stagingDir) => {

0 commit comments

Comments
 (0)