Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

fix(integrations): confine integrations:test probe path (secret-exfil SSRF)

Chaitanya Giri47e78a6003b1
diff --git a/src/main/index.ts b/src/main/index.ts
index ca091f29..ae5bbee1 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -30,7 +30,7 @@ import { transcribeWithGroq, DEFAULT_GROQ_MODEL } from './freeflow';
import { TelemetryCollector } from './telemetry';
import { IntegrationBroker } from './integrationBroker';
import * as integrations from './integrations';
-import { validateBaseUrl, buildAuthHeaders, secretRefFor, INTEGRATION_TEMPLATES } from '../shared/integrations';
+import { validateBaseUrl, buildAuthHeaders, resolveUpstreamUrl, secretRefFor, INTEGRATION_TEMPLATES } from '../shared/integrations';
import { ControlRegistry } from './control';
import { fetchHireManifest, readHireManifestFile } from './hire';
import { parseHireDeepLink, type HireManifest } from '../shared/hire';
@@ -2002,12 +2002,17 @@ ipcMain.handle('integrations:test', async (_evt, payload: unknown) => {
if (!rec) return { ok: false, error: 'unknown integration' };
const probe = validateBaseUrl(rec.baseUrl);
if (!probe.ok) return { ok: false, error: probe.error };
+ // Confine the probe path through the SAME gate as the worker forward() path, so an
+ // absolute URL / backslash-host / traversal in p.path can't override the origin and
+ // exfiltrate the secret to an attacker host. Resolve (and reject) BEFORE the secret
+ // is ever materialized, so a bad path never even decrypts it.
+ const target = resolveUpstreamUrl(rec.baseUrl, typeof p.path === 'string' ? p.path : '');
+ if (!target) return { ok: false, error: 'path escapes the integration baseUrl', code: 'bad_request' };
const secret = integrations.getSecret(rec.secretRef);
const headers = buildAuthHeaders(rec.authType, rec.authHeader, secret);
try {
const ac = new AbortController();
const timer = setTimeout(() => ac.abort(), 15_000);
- const target = typeof p.path === 'string' && p.path ? new URL(p.path.replace(/^\/+/, ''), probe.url.origin) : probe.url;
const r = await fetch(target, { method: 'GET', headers, redirect: 'manual', signal: ac.signal });
clearTimeout(timer);
return { ok: r.ok, status: r.status };