惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
J
Java Code Geeks
C
Check Point Blog
Last Week in AI
Last Week in AI
Microsoft Azure Blog
Microsoft Azure Blog
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
L
LangChain Blog
有赞技术团队
有赞技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 司徒正美
IT之家
IT之家
Martin Fowler
Martin Fowler
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tailwind CSS Blog
U
Unit 42
Jina AI
Jina AI
Microsoft Security Blog
Microsoft Security Blog
I
InfoQ

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(hooks): share Windows gog command wrapping · openclaw...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main
11

// Gmail hook helpers manage Gmail OAuth setup and watcher launch state.

22

import { randomBytes } from "node:crypto";

3-

import path from "node:path";

4-

import { normalizeLowercaseStringOrEmpty } from "@openclaw/normalization-core/string-coerce";

53

import { normalizeUniqueStringEntries } from "@openclaw/normalization-core/string-normalization";

64

import {

75

type OpenClawConfig,

@@ -10,7 +8,11 @@ import {

108

resolveGatewayPort,

119

} from "../config/config.js";

1210

import { resolveExecutable } from "../infra/executable-path.js";

13-

import { getWindowsInstallRoots } from "../infra/windows-install-roots.js";

11+

import {

12+

buildWindowsCmdExeCommandLine,

13+

isWindowsBatchCommand,

14+

resolveTrustedWindowsCmdExe,

15+

} from "../process/windows-command.js";

14161517

export const DEFAULT_GMAIL_LABEL = "INBOX";

1618

export const DEFAULT_GMAIL_TOPIC = "gog-gmail-watch";

@@ -22,7 +24,6 @@ export const DEFAULT_GMAIL_MAX_BYTES = 20_000;

2224

export const DEFAULT_GMAIL_RENEW_MINUTES = 12 * 60;

2325

const DEFAULT_HOOKS_PATH = "/hooks";

2426

const GMAIL_WATCH_SENSITIVE_FLAGS = new Set(["--token", "--hook-url", "--hook-token"]);

25-

const WINDOWS_UNSAFE_CMD_CHARS_RE = /[&|<>^%\r\n]/;

2627

let gogBin: string | undefined;

27282829

export type GmailHookOverrides = {

@@ -271,31 +272,19 @@ export function resolveGogExecutable(): string {

271272

return (gogBin ??= resolveExecutable("gog"));

272273

}

273274274-

function escapeForCmdExe(arg: string): string {

275-

if (WINDOWS_UNSAFE_CMD_CHARS_RE.test(arg)) {

276-

throw new Error(`Unsafe Windows cmd.exe argument detected: ${JSON.stringify(arg)}`);

277-

}

278-

if (!arg.includes(" ") && !arg.includes('"')) {

279-

return arg;

280-

}

281-

return `"${arg.replace(/"/g, '""')}"`;

282-

}

283-284275

export function resolveGogServeInvocation(args: string[]): {

285276

args: string[];

286277

command: string;

287278

windowsHide?: true;

288279

windowsVerbatimArguments?: true;

289280

} {

290281

const command = resolveGogExecutable();

291-

const ext = normalizeLowercaseStringOrEmpty(path.extname(command));

292-

if (process.platform !== "win32" || (ext !== ".cmd" && ext !== ".bat")) {

282+

if (!isWindowsBatchCommand(command)) {

293283

return { command, args, windowsHide: process.platform === "win32" ? true : undefined };

294284

}

295-

const cmdExe = path.win32.join(getWindowsInstallRoots().systemRoot, "System32", "cmd.exe");

296285

return {

297-

command: cmdExe,

298-

args: ["/d", "/s", "/c", [command, ...args].map(escapeForCmdExe).join(" ")],

286+

command: resolveTrustedWindowsCmdExe(),

287+

args: ["/d", "/s", "/c", buildWindowsCmdExeCommandLine(command, args)],

299288

windowsHide: true,

300289

windowsVerbatimArguments: true,

301290

};