Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: keep the server's sandbox backends allowlist

ogsamrate7ccd262541e
diff --git a/apps/server/src/omnirush-gateway-broker.test.ts b/apps/server/src/omnirush-gateway-broker.test.ts
index 5fcc7a03..3f9a43bc 100644
--- a/apps/server/src/omnirush-gateway-broker.test.ts
+++ b/apps/server/src/omnirush-gateway-broker.test.ts
@@ -1506,6 +1506,18 @@ describe("OmniRush gateway broker upload keys, account and integrity", () => {
expect(integrityCalls).toEqual(["https://gateway.example/omnirush/me/sessions/ses_feature_1234/integrity"]);
});
+ test("the Linux sandbox block keeps the server's backends allowlist", async () => {
+ let localBox: Record<string, unknown> = { default: "on", max_turn_bytes: 268435456, backends: ["bwrap", "podman", 7] };
+ const make = () => new OmniRushGatewayBroker({
+ credentials,
+ engineToken: "local-engine-token",
+ fetch: async () => Response.json({ schema_versions: [2, 3], canonical_trace: true, local_box: localBox }),
+ });
+ expect((await make().sessionUploadCapabilities()).local_box).toEqual({ default: "on", max_turn_bytes: 268435456, backends: ["bwrap", "podman"] });
+ localBox = { default: "offer", backends: null };
+ expect((await make().sessionUploadCapabilities()).local_box).toEqual({ default: "offer", max_turn_bytes: null, backends: null });
+ });
+
const credentials = { gatewayUrl: "https://gateway.example/omnirush/v1", accessToken: "access-1", refreshToken: "refresh-1" };
test("uploadSession and uploadSessionFile send the Idempotency-Key they are given", async () => {
diff --git a/apps/server/src/omnirush-gateway-broker.ts b/apps/server/src/omnirush-gateway-broker.ts
index 3034f599..2a0dfc32 100644
--- a/apps/server/src/omnirush-gateway-broker.ts
+++ b/apps/server/src/omnirush-gateway-broker.ts
@@ -730,6 +730,12 @@ function secureEqual(left: string, right: string): boolean {
return a.length === b.length && a.length > 0 && timingSafeEqual(a, b);
}
+/** The Linux sandbox block of a /collect/capabilities answer: the default, the turn cap and the backends allowlist (null: any). */
+function localBoxCapability(block: Record<string, unknown>): NonNullable<TraceCapabilities["local_box"]> {
+ const backends = Array.isArray(block.backends) ? block.backends.filter((item): item is string => typeof item === "string") : null;
+ return { default: String(block.default ?? "off"), max_turn_bytes: typeof block.max_turn_bytes === "number" ? block.max_turn_bytes : null, backends };
+}
+
/** The feature flags of a /collect/capabilities answer, each true only when the backend says so. */
function uploadFeatureFlags(payload: Record<string, unknown>): Pick<TraceCapabilities, "idempotency_key" | "body_sha256" | "integrity" | "integrity_summary" | "recovered_segments"> {
return {
@@ -1523,7 +1529,7 @@ export class OmniRushGatewayBroker {
...(triggers ? { triggers } : {}),
// The install log switch, passed on as the server said it (context/install-log.ts reads it).
...(installLog ? { install_log: { enabled: installLog.enabled === true, sample_percent: typeof installLog.sample_percent === "number" ? installLog.sample_percent : 100 } } : {}),
- ...(isRecord(payload.local_box) ? { local_box: { default: String(payload.local_box.default ?? "off"), max_turn_bytes: typeof payload.local_box.max_turn_bytes === "number" ? payload.local_box.max_turn_bytes : null } } : {}),
+ ...(isRecord(payload.local_box) ? { local_box: localBoxCapability(payload.local_box) } : {}),
};
} catch {
return null;
diff --git a/apps/server/src/session-uploader.ts b/apps/server/src/session-uploader.ts
index 83b789ed..7db98a6d 100644
--- a/apps/server/src/session-uploader.ts
+++ b/apps/server/src/session-uploader.ts
@@ -831,8 +831,8 @@ export type TraceCapabilities = {
triggers?: string[];
/** The install log switch (context/install-log.ts): absent is off. */
install_log?: { enabled: boolean; sample_percent: number };
- /** The Linux sandbox's server default (box/launch.ts serverDefault): "off" | "offer" | "on". */
- local_box?: { default: string; max_turn_bytes?: number | null };
+ /** The Linux sandbox's server default (box/launch.ts serverDefault): "off" | "offer" | "on", and the backends it allows (serverBackends). */
+ local_box?: { default: string; max_turn_bytes?: number | null; backends?: string[] | null };
};