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

推荐订阅源

有赞技术团队
有赞技术团队
G
Google Developers Blog
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
J
Java Code Geeks
P
Proofpoint News Feed
V
Visual Studio Blog
爱范儿
爱范儿
The Cloudflare Blog
博客园 - 叶小钗
V
V2EX
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
M
MIT News - Artificial intelligence
Microsoft Security Blog
Microsoft Security Blog
博客园 - 聂微东
H
Help Net Security
B
Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 【当耐特】
量子位
宝玉的分享
宝玉的分享
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

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: restore codex permission approval targets (#70340) (...
steipete · 2026-04-23 · via Recent Commits to openclaw:main

@@ -7,6 +7,9 @@ import {

77

import { isJsonObject, type JsonObject, type JsonValue } from "./protocol.js";

8899

const DEFAULT_CODEX_APPROVAL_TIMEOUT_MS = 120_000;

10+

const PERMISSION_DESCRIPTION_MAX_LENGTH = 700;

11+

const PERMISSION_SAMPLE_LIMIT = 2;

12+

const PERMISSION_VALUE_MAX_LENGTH = 48;

10131114

export type AppServerApprovalOutcome =

1215

| "approved-once"

@@ -208,23 +211,22 @@ function buildApprovalContext(params: {

208211

? "Codex app-server command approval"

209212

: params.method === "item/permissions/requestApproval"

210213

? "Codex app-server permission approval"

211-

: kind === "plugin"

212-

? "Codex app-server file approval"

213-

: "Codex app-server approval";

214+

: kind === "plugin"

215+

? "Codex app-server file approval"

216+

: "Codex app-server approval";

214217

const subject =

215218

permissionLines[0] ??

216219

(command

217220

? `Command: ${truncate(command, 180)}`

218221

: reason

219222

? `Reason: ${truncate(reason, 180)}`

220223

: `Request method: ${params.method}`);

221-

const description = joinDescriptionLinesWithinLimit(

222-

[

223-

subject,

224-

...permissionLines.slice(1),

225-

].filter((line): line is string => Boolean(line)),

226-

256,

227-

);

224+

const description =

225+

permissionLines.length > 0

226+

? joinDescriptionLinesWithinLimit(permissionLines, PERMISSION_DESCRIPTION_MAX_LENGTH)

227+

: [subject, params.paramsForRun.sessionKey && `Session: ${params.paramsForRun.sessionKey}`]

228+

.filter(Boolean)

229+

.join("\n");

228230

return {

229231

kind,

230232

title,

@@ -326,6 +328,7 @@ function describeRequestedPermissions(requestParams: JsonObject | undefined): st

326328

const permissions = requestedPermissions(requestParams);

327329

const lines: string[] = [];

328330

const kinds: string[] = [];

331+

const risks = new Set<string>();

329332

if (isJsonObject(permissions.network)) {

330333

kinds.push("network");

331334

}

@@ -336,40 +339,45 @@ function describeRequestedPermissions(requestParams: JsonObject | undefined): st

336339

lines.push(`Permissions: ${kinds.join(", ")}`);

337340

}

338341

if (isJsonObject(permissions.network)) {

339-

lines.push(

340-

summarizePermissionRecord("Network permission requested", permissions.network, [

341-

{

342-

key: "allowHosts",

343-

label: "allowHosts",

344-

sanitize: sanitizePermissionHostValue,

345-

risksFor: permissionHostRisks,

346-

},

347-

]),

348-

);

342+

const networkSummary = summarizePermissionRecord(permissions.network, risks, [

343+

{

344+

key: "allowHosts",

345+

label: "allowHosts",

346+

sanitize: sanitizePermissionHostValue,

347+

risksFor: permissionHostRisks,

348+

},

349+

]);

350+

if (networkSummary) {

351+

lines.push(`Network ${networkSummary}`);

352+

}

349353

}

350354

if (isJsonObject(permissions.fileSystem)) {

351-

lines.push(

352-

summarizePermissionRecord("File system permission requested", permissions.fileSystem, [

353-

{

354-

key: "roots",

355-

label: "roots",

356-

sanitize: sanitizePermissionPathValue,

357-

risksFor: permissionPathRisks,

358-

},

359-

{

360-

key: "readPaths",

361-

label: "readPaths",

362-

sanitize: sanitizePermissionPathValue,

363-

risksFor: permissionPathRisks,

364-

},

365-

{

366-

key: "writePaths",

367-

label: "writePaths",

368-

sanitize: sanitizePermissionPathValue,

369-

risksFor: permissionPathRisks,

370-

},

371-

]),

372-

);

355+

const fileSystemSummary = summarizePermissionRecord(permissions.fileSystem, risks, [

356+

{

357+

key: "roots",

358+

label: "roots",

359+

sanitize: sanitizePermissionPathValue,

360+

risksFor: permissionPathRisks,

361+

},

362+

{

363+

key: "readPaths",

364+

label: "readPaths",

365+

sanitize: sanitizePermissionPathValue,

366+

risksFor: permissionPathRisks,

367+

},

368+

{

369+

key: "writePaths",

370+

label: "writePaths",

371+

sanitize: sanitizePermissionPathValue,

372+

risksFor: permissionPathRisks,

373+

},

374+

]);

375+

if (fileSystemSummary) {

376+

lines.push(`File system ${fileSystemSummary}`);

377+

}

378+

}

379+

if (risks.size > 0) {

380+

lines.push(`High-risk targets: ${[...risks].join(", ")}`);

373381

}

374382

return lines;

375383

}

@@ -382,26 +390,18 @@ type PermissionArrayDescriptor = {

382390

};

383391384392

function summarizePermissionRecord(

385-

label: string,

386393

permission: JsonObject,

394+

risks: Set<string>,

387395

descriptors: readonly PermissionArrayDescriptor[],

388-

): string {

396+

): string | undefined {

389397

const details: string[] = [];

390-

const risks = new Set<string>();

391398

for (const descriptor of descriptors) {

392399

const summary = summarizePermissionArray(permission, descriptor, risks);

393400

if (summary) {

394401

details.push(summary);

395402

}

396403

}

397-

const suffix: string[] = [];

398-

if (details.length > 0) {

399-

suffix.push(details.join("; "));

400-

}

401-

if (risks.size > 0) {

402-

suffix.push(`high-risk: ${[...risks].join(", ")}`);

403-

}

404-

return suffix.length > 0 ? `${label} (${suffix.join("; ")})` : label;

404+

return details.length > 0 ? details.join("; ") : undefined;

405405

}

406406407407

function summarizePermissionArray(

@@ -418,7 +418,10 @@ function summarizePermissionArray(

418418

risks.add(risk);

419419

}

420420

}

421-

const sampleValues = values.slice(0, 2).map(descriptor.sanitize).filter(Boolean);

421+

const sampleValues = values

422+

.slice(0, PERMISSION_SAMPLE_LIMIT)

423+

.map(descriptor.sanitize)

424+

.filter(Boolean);

422425

if (sampleValues.length === 0) {

423426

return `${descriptor.label}: ${values.length}`;

424427

}

@@ -435,16 +438,31 @@ function readStringArray(record: JsonObject, key: string): string[] {

435438

}

436439437440

function sanitizePermissionHostValue(value: string): string {

438-

return truncate(value.replace(/\s+/g, " ").trim().toLowerCase(), 48);

441+

const compact = sanitizePermissionScalar(value).toLowerCase();

442+

const withoutScheme = compact.replace(/^[a-z][a-z0-9+.-]*:\/\//, "");

443+

const authority = withoutScheme.split(/[/?#]/, 1)[0] ?? withoutScheme;

444+

const withoutUserInfo = authority.includes("@")

445+

? authority.slice(authority.lastIndexOf("@") + 1)

446+

: authority;

447+

return truncate(withoutUserInfo, PERMISSION_VALUE_MAX_LENGTH);

439448

}

440449441450

function sanitizePermissionPathValue(value: string): string {

442-

const normalized = value.replace(/\s+/g, " ").trim();

451+

const normalized = sanitizePermissionScalar(value);

443452

const homeCompacted = normalized

444453

.replace(/^\/home\/[^/]+(?=\/|$)/, "~")

445454

.replace(/^\/Users\/[^/]+(?=\/|$)/, "~")

446455

.replace(/^[A-Za-z]:\\Users\\[^\\]+(?=\\|$)/, "~");

447-

return truncate(homeCompacted, 48);

456+

return truncate(homeCompacted, PERMISSION_VALUE_MAX_LENGTH);

457+

}

458+459+

function sanitizePermissionScalar(value: string): string {

460+

let sanitized = "";

461+

for (let index = 0; index < value.length; index += 1) {

462+

const code = value.charCodeAt(index);

463+

sanitized += code < 32 || code === 127 ? " " : value[index];

464+

}

465+

return sanitized.replace(/\s+/g, " ").trim();

448466

}

449467450468

function permissionHostRisks(value: string): string[] {