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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
Last Week in AI
Last Week in AI
腾讯CDC
The Cloudflare Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MyScale Blog
MyScale Blog
博客园 - Franky
MongoDB | Blog
MongoDB | Blog
I
InfoQ
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
Y
Y Combinator Blog
H
Help Net Security
T
Tailwind CSS Blog
美团技术团队
aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
P
Proofpoint News Feed

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(cli): validate debug proxy numeric options (#84260) ·...
jbetala7 · 2026-05-23 · via Recent Commits to openclaw:main

@@ -1,4 +1,4 @@

1-

import type { Command } from "commander";

1+

import { InvalidArgumentError, type Command } from "commander";

22

import type { CaptureQueryPreset } from "../proxy-capture/types.js";

33

import { createLazyImportLoader } from "../shared/lazy-promise.js";

44

@@ -12,12 +12,32 @@ async function loadProxyCliRuntime(): Promise<ProxyCliRuntime> {

1212

return await proxyCliRuntimeLoader.load();

1313

}

141415-

function parseOptionalNumber(value: string | undefined): number | undefined {

16-

if (!value) {

17-

return undefined;

15+

function parseIntegerOption(value: string | undefined, flag: string): number {

16+

const trimmed = value?.trim() ?? "";

17+

if (!/^\d+$/u.test(trimmed)) {

18+

throw new InvalidArgumentError(`${flag} must be an integer.`);

1819

}

19-

const parsed = Number(value);

20-

return Number.isFinite(parsed) ? parsed : undefined;

20+

const parsed = Number(trimmed);

21+

if (!Number.isSafeInteger(parsed)) {

22+

throw new InvalidArgumentError(`${flag} must be a safe integer.`);

23+

}

24+

return parsed;

25+

}

26+27+

function parsePortOption(value: string | undefined): number {

28+

const parsed = parseIntegerOption(value, "--port");

29+

if (parsed > 65_535) {

30+

throw new InvalidArgumentError("--port must be between 0 and 65535.");

31+

}

32+

return parsed;

33+

}

34+35+

function parsePositiveIntegerOption(value: string | undefined, flag: string): number {

36+

const parsed = parseIntegerOption(value, flag);

37+

if (parsed <= 0) {

38+

throw new InvalidArgumentError(`${flag} must be a positive integer.`);

39+

}

40+

return parsed;

2141

}

22422343

function collectOption(value: string, previous: string[] | undefined): string[] {

@@ -33,7 +53,7 @@ export function registerProxyCli(program: Command) {

3353

.command("start")

3454

.description("Start the local explicit debug proxy")

3555

.option("--host <host>", "Bind host", "127.0.0.1")

36-

.option("--port <port>", "Bind port", parseOptionalNumber)

56+

.option("--port <port>", "Bind port", parsePortOption)

3757

.action(async (opts: { host?: string; port?: number }) => {

3858

const runtime = await loadProxyCliRuntime();

3959

await runtime.runDebugProxyStartCommand(opts);

@@ -45,7 +65,7 @@ export function registerProxyCli(program: Command) {

4565

.allowUnknownOption(true)

4666

.allowExcessArguments(true)

4767

.option("--host <host>", "Bind host", "127.0.0.1")

48-

.option("--port <port>", "Bind port", parseOptionalNumber)

68+

.option("--port <port>", "Bind port", parsePortOption)

4969

.argument("[cmd...]", "Command to run after --")

5070

.action(async (cmd: string[], opts: { host?: string; port?: number }) => {

5171

const runtime = await loadProxyCliRuntime();

@@ -70,7 +90,9 @@ export function registerProxyCli(program: Command) {

7090

.option("--denied-url <url>", "Destination expected to be blocked by the proxy", collectOption)

7191

.option("--apns-reachable", "Also verify sandbox APNs HTTP/2 is reachable through the proxy")

7292

.option("--apns-authority <url>", "APNs authority to probe with --apns-reachable")

73-

.option("--timeout-ms <ms>", "Per-request timeout in milliseconds", parseOptionalNumber)

93+

.option("--timeout-ms <ms>", "Per-request timeout in milliseconds", (value) =>

94+

parsePositiveIntegerOption(value, "--timeout-ms"),

95+

)

7496

.action(

7597

async (opts: {

7698

json?: boolean;

@@ -107,7 +129,9 @@ export function registerProxyCli(program: Command) {

107129

proxy

108130

.command("sessions")

109131

.description("List recent capture sessions")

110-

.option("--limit <count>", "Maximum sessions to show", parseOptionalNumber)

132+

.option("--limit <count>", "Maximum sessions to show", (value) =>

133+

parsePositiveIntegerOption(value, "--limit"),

134+

)

111135

.action(async (opts: { limit?: number }) => {

112136

const runtime = await loadProxyCliRuntime();

113137

await runtime.runDebugProxySessionsCommand(opts);