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

推荐订阅源

MyScale Blog
MyScale Blog
J
Java Code Geeks
Vercel News
Vercel News
A
About on SuperTechFans
G
Google Developers Blog
C
Check Point Blog
腾讯CDC
N
Netflix TechBlog - Medium
博客园 - 司徒正美
S
SegmentFault 最新的问题
D
DataBreaches.Net
博客园_首页
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
量子位
雷峰网
雷峰网
IT之家
IT之家
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
博客园 - 三生石上(FineUI控件)
H
Help Net Security
宝玉的分享
宝玉的分享
博客园 - 叶小钗

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: address issue (#81069) · openclaw/openclaw@0aabaeb
mmaps · 2026-05-22 · via Recent Commits to openclaw:main

@@ -0,0 +1,178 @@

1+

import fs from "node:fs";

2+

import path from "node:path";

3+

import { afterEach, describe, expect, it } from "vitest";

4+

import { withEnv } from "../test-utils/env.js";

5+

import { resetPluginLoaderTestStateForTest } from "./loader.test-fixtures.js";

6+

import { resolvePluginProviders } from "./providers.runtime.js";

7+

import {

8+

cleanupTrackedTempDirs,

9+

makeTrackedTempDir,

10+

mkdirSafeDir,

11+

} from "./test-helpers/fs-fixtures.js";

12+13+

const tempDirs: string[] = [];

14+15+

afterEach(() => {

16+

cleanupTrackedTempDirs(tempDirs);

17+

resetPluginLoaderTestStateForTest();

18+

});

19+20+

function makeTempDir() {

21+

return makeTrackedTempDir("openclaw-provider-setup-trust", tempDirs);

22+

}

23+24+

function writeJson(filePath: string, value: unknown) {

25+

fs.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`, "utf-8");

26+

}

27+28+

function readMarkerLines(filePath: string): string[] {

29+

if (!fs.existsSync(filePath)) {

30+

return [];

31+

}

32+

return fs

33+

.readFileSync(filePath, "utf-8")

34+

.split("\n")

35+

.map((line) => line.trim())

36+

.filter(Boolean);

37+

}

38+39+

function writeWorkspaceProviderPlugin(params: {

40+

workspaceDir: string;

41+

pluginId: string;

42+

providerId: string;

43+

markerDir: string;

44+

}) {

45+

const pluginDir = path.join(params.workspaceDir, ".openclaw", "extensions", params.pluginId);

46+

mkdirSafeDir(pluginDir);

47+

writeJson(path.join(pluginDir, "openclaw.plugin.json"), {

48+

id: params.pluginId,

49+

name: "Setup Trust Provider",

50+

description: "Test workspace provider plugin",

51+

configSchema: {

52+

type: "object",

53+

additionalProperties: false,

54+

properties: {},

55+

},

56+

providers: [params.providerId],

57+

});

58+

fs.writeFileSync(

59+

path.join(pluginDir, "index.cjs"),

60+

`const fs = require("node:fs");

61+

const path = require("node:path");

62+63+

const markerDir = ${JSON.stringify(params.markerDir)};

64+

fs.mkdirSync(markerDir, { recursive: true });

65+

fs.appendFileSync(

66+

path.join(markerDir, "top-level.txt"),

67+

JSON.stringify({ event: "top-level", registrationMode: "module-import" }) + "\\n",

68+

);

69+70+

module.exports = {

71+

id: ${JSON.stringify(params.pluginId)},

72+

register(api) {

73+

fs.appendFileSync(

74+

path.join(markerDir, "register.txt"),

75+

JSON.stringify({ event: "register", registrationMode: api.registrationMode }) + "\\n",

76+

);

77+

api.registerProvider({

78+

id: ${JSON.stringify(params.providerId)},

79+

label: "Setup Trust Provider",

80+

auth: [],

81+

});

82+

},

83+

};

84+

`,

85+

"utf-8",

86+

);

87+

}

88+89+

describe("setup provider workspace trust", () => {

90+

it("does not import untrusted workspace provider plugins during default setup discovery", () => {

91+

const runRoot = makeTempDir();

92+

const workspaceDir = path.join(runRoot, "workspace");

93+

const stateDir = path.join(runRoot, "state");

94+

const markerDir = path.join(runRoot, "markers");

95+

mkdirSafeDir(workspaceDir);

96+

mkdirSafeDir(stateDir);

97+

mkdirSafeDir(markerDir);

98+

writeWorkspaceProviderPlugin({

99+

workspaceDir,

100+

pluginId: "setup-autoload-provider",

101+

providerId: "setup-autoload",

102+

markerDir,

103+

});

104+105+

const env: NodeJS.ProcessEnv = {

106+

OPENCLAW_STATE_DIR: stateDir,

107+

OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",

108+

OPENCLAW_BUNDLED_PLUGINS_DIR: undefined,

109+

};

110+111+

withEnv(env, () => {

112+

const providers = resolvePluginProviders({

113+

config: {

114+

plugins: {

115+

enabled: true,

116+

},

117+

},

118+

workspaceDir,

119+

env,

120+

mode: "setup",

121+

cache: false,

122+

onlyPluginIds: ["setup-autoload-provider"],

123+

});

124+125+

expect(providers).toStrictEqual([]);

126+

});

127+

expect(readMarkerLines(path.join(markerDir, "top-level.txt"))).toStrictEqual([]);

128+

expect(readMarkerLines(path.join(markerDir, "register.txt"))).toStrictEqual([]);

129+

});

130+131+

it("loads explicitly trusted workspace provider plugins during setup discovery", () => {

132+

const runRoot = makeTempDir();

133+

const workspaceDir = path.join(runRoot, "workspace");

134+

const stateDir = path.join(runRoot, "state");

135+

const markerDir = path.join(runRoot, "markers");

136+

mkdirSafeDir(workspaceDir);

137+

mkdirSafeDir(stateDir);

138+

mkdirSafeDir(markerDir);

139+

writeWorkspaceProviderPlugin({

140+

workspaceDir,

141+

pluginId: "setup-trusted-provider",

142+

providerId: "setup-trusted",

143+

markerDir,

144+

});

145+146+

const env: NodeJS.ProcessEnv = {

147+

OPENCLAW_STATE_DIR: stateDir,

148+

OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1",

149+

OPENCLAW_BUNDLED_PLUGINS_DIR: undefined,

150+

};

151+152+

withEnv(env, () => {

153+

const providers = resolvePluginProviders({

154+

config: {

155+

plugins: {

156+

allow: ["setup-trusted-provider"],

157+

},

158+

},

159+

workspaceDir,

160+

env,

161+

mode: "setup",

162+

cache: false,

163+

onlyPluginIds: ["setup-trusted-provider"],

164+

});

165+166+

expect(providers).toEqual([

167+

{

168+

id: "setup-trusted",

169+

label: "Setup Trust Provider",

170+

auth: [],

171+

pluginId: "setup-trusted-provider",

172+

},

173+

]);

174+

});

175+

expect(readMarkerLines(path.join(markerDir, "top-level.txt"))).toHaveLength(1);

176+

expect(readMarkerLines(path.join(markerDir, "register.txt"))).toHaveLength(1);

177+

});

178+

});