Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(devin): keep the authenticate API key out of the native log

VNATdev-opsae38437b7cf4
diff --git a/server/drivers/acp/devin.test.ts b/server/drivers/acp/devin.test.ts
index a07f424ddc..e3a3041c73 100644
--- a/server/drivers/acp/devin.test.ts
+++ b/server/drivers/acp/devin.test.ts
@@ -204,7 +204,7 @@ describe("Devin ACP driver", () => {
it("fails discovery without calling authenticate when the CLI requires a key and none is available", async () => {
const dump = join(scratch, "discovery-no-key.json");
await expect(resolveDevinModels({
- ...process.env, FAKE_ACP_MODELS: MODELS, FAKE_ACP_MODE: "auth-required-api-key", FAKE_ACP_AUTH_METHOD: "devin-browser",
+ ...process.env, WINDSURF_API_KEY: "", FAKE_ACP_MODELS: MODELS, FAKE_ACP_MODE: "auth-required-api-key", FAKE_ACP_AUTH_METHOD: "devin-browser",
FAKE_ACP_EXPECTED_API_KEY: "engine-fixture-key", FAKE_ACP_DUMP: dump,
}, { cli: FAKE_CLI })).rejects.toThrow(/ACP model discovery/);
expect(existsSync(`${dump}.authenticate.json`)).toBe(false);
diff --git a/server/drivers/acp/tool-log.test.ts b/server/drivers/acp/tool-log.test.ts
new file mode 100644
index 0000000000..b49aacbaec
--- /dev/null
+++ b/server/drivers/acp/tool-log.test.ts
@@ -0,0 +1,18 @@
+import { describe, expect, it } from "vitest";
+
+import { acpNativeLogMessage } from "./tool-log.ts";
+
+describe("acpNativeLogMessage", () => {
+ it("redacts authenticate _meta in the log copy without changing the wire message", () => {
+ const wire = {
+ jsonrpc: "2.0", id: 7, method: "authenticate",
+ params: { methodId: "devin-browser", _meta: { api_key: "fixture-secret" } },
+ };
+
+ const logged = acpNativeLogMessage(wire, false) as { params: { methodId: string; _meta: string } };
+
+ expect(logged.params).toEqual({ methodId: "devin-browser", _meta: "[redacted]" });
+ expect(JSON.stringify(logged)).not.toContain("fixture-secret");
+ expect(wire.params._meta).toEqual({ api_key: "fixture-secret" });
+ });
+});
diff --git a/server/drivers/acp/tool-log.ts b/server/drivers/acp/tool-log.ts
index 3bb14e8438..f66dc36c7c 100644
--- a/server/drivers/acp/tool-log.ts
+++ b/server/drivers/acp/tool-log.ts
@@ -38,7 +38,11 @@ export function sanitizeAcpToolMessage(message: any): unknown {
/** What the native log keeps of any ACP message: inline images stay on the wire but never go in as base64. */
export function acpNativeLogMessage(msg: any, sanitizeToolPayload: boolean): unknown {
let redacted = msg;
- const prompt = msg?.method === "session/prompt" ? msg?.params?.prompt : null;
+ // authenticate carries the API key in _meta: keep it on the wire, never in the native log.
+ if (msg?.method === "authenticate" && msg?.params?._meta !== undefined) {
+ redacted = { ...msg, params: { ...msg.params, _meta: "[redacted]" } };
+ }
+ const prompt = redacted?.method === "session/prompt" ? redacted?.params?.prompt : null;
if (Array.isArray(prompt)) {
redacted = {
...msg,