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

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
博客园 - 聂微东
Jina AI
Jina AI
The Cloudflare Blog
V
Visual Studio Blog
博客园_首页
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
博客园 - Franky

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(config): resolve DM allowFrom via canonical-or-legacy...
amknight · 2026-06-17 · via Recent Commits to openclaw:main

@@ -5,6 +5,11 @@ import { isCanonicalDottedDecimalIPv4, isLoopbackIpAddress } from "@openclaw/net

55

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

66

import { sanitizeForLog } from "../../packages/terminal-core/src/ansi.js";

77

import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agents/agent-scope.js";

8+

import {

9+

resolveChannelDmAllowFrom,

10+

resolveChannelDmPolicy,

11+

} from "../channels/plugins/dm-access.js";

12+

import { getDoctorChannelCapabilities } from "../commands/doctor/channel-capabilities.js";

813

import { isPathInside } from "../infra/path-guards.js";

914

import { planManifestModelCatalogSuppressions } from "../model-catalog/index.js";

1015

import {

@@ -316,15 +321,6 @@ function formatRawChannelConfigIssueMessage(message: string): string {

316321

return `invalid config: ${message}`;

317322

}

318323319-

function asAllowFromList(value: unknown): Array<string | number> | undefined {

320-

if (!Array.isArray(value)) {

321-

return undefined;

322-

}

323-

return value.filter(

324-

(entry): entry is string | number => typeof entry === "string" || typeof entry === "number",

325-

);

326-

}

327-328324

function buildDmPolicyDependencyWarning(params: {

329325

channelId: string;

330326

accountId?: string;

@@ -344,27 +340,37 @@ function buildDmPolicyDependencyWarning(params: {

344340

return { path: allowFromPath, message };

345341

}

346342343+

// Channel map keys that are not channels and must be skipped while scanning DM policy.

344+

const DM_POLICY_PSEUDO_CHANNEL_KEYS = new Set(["defaults", "modelByChannel", "tools"]);

345+347346

/**

348347

* Surface dmPolicy/allowFrom dependency problems generically for every channel that

349-

* uses the shared top-level dmPolicy/allowFrom contract. These configs parse fine but

350-

* drop every DM at runtime, so we warn (rather than reject) to stay consistent with

351-

* `security audit`/`doctor` and avoid breaking existing-but-usable configs on upgrade.

348+

* exposes DM policy via the canonical top-level `dmPolicy`/`allowFrom` fields. These

349+

* configs parse fine but drop every DM at runtime, so we warn (rather than reject) to

350+

* stay consistent with `security audit`/`doctor` and avoid breaking existing-but-usable

351+

* configs on upgrade.

352+

*

353+

* Resolution goes through the shared DM-access helpers so the warning matches the

354+

* effective policy/allowFrom the runtime sees, including the legacy `dm.*` aliases and

355+

* account->channel inheritance. `nestedOnly` channels (canonical fields under `dm.*`)

356+

* are skipped because their config shape does not match this warning's top-level paths.

352357

*/

353358

function collectChannelDmPolicyDependencyWarnings(config: OpenClawConfig): ConfigValidationIssue[] {

354359

if (!config.channels || !isRecord(config.channels)) {

355360

return [];

356361

}

357362

const warnings: ConfigValidationIssue[] = [];

358363

for (const [channelId, channelValue] of Object.entries(config.channels)) {

359-

if (channelId === "defaults" || channelId === "modelByChannel" || !isRecord(channelValue)) {

364+

if (DM_POLICY_PSEUDO_CHANNEL_KEYS.has(channelId) || !isRecord(channelValue)) {

365+

continue;

366+

}

367+

const mode = getDoctorChannelCapabilities(channelId).dmAllowFromMode;

368+

if (mode === "nestedOnly") {

360369

continue;

361370

}

362-

const channelPolicy =

363-

typeof channelValue.dmPolicy === "string" ? channelValue.dmPolicy : undefined;

364-

const channelAllowFrom = asAllowFromList(channelValue.allowFrom);

365371

const channelViolation = evaluateDmPolicyAllowFromDependency({

366-

policy: channelPolicy,

367-

allowFrom: channelAllowFrom,

372+

policy: resolveChannelDmPolicy({ account: channelValue, mode }),

373+

allowFrom: resolveChannelDmAllowFrom({ account: channelValue, mode }),

368374

});

369375

if (channelViolation) {

370376

warnings.push(buildDmPolicyDependencyWarning({ channelId, violation: channelViolation }));

@@ -377,8 +383,8 @@ function collectChannelDmPolicyDependencyWarnings(config: OpenClawConfig): Confi

377383

continue;

378384

}

379385

const accountViolation = evaluateDmPolicyAllowFromDependency({

380-

policy: typeof accountValue.dmPolicy === "string" ? accountValue.dmPolicy : channelPolicy,

381-

allowFrom: asAllowFromList(accountValue.allowFrom) ?? channelAllowFrom,

386+

policy: resolveChannelDmPolicy({ account: accountValue, parent: channelValue, mode }),

387+

allowFrom: resolveChannelDmAllowFrom({ account: accountValue, parent: channelValue, mode }),

382388

});

383389

if (accountViolation) {

384390

warnings.push(