@@ -104,6 +104,16 @@ function firstMockArg(mockFn: ReturnType<typeof vi.fn>, label: string): Record<s
|
104 | 104 | return arg as Record<string, any>; |
105 | 105 | } |
106 | 106 | |
| 107 | +function writeSecurePluginEntrypoint(pathname: string): void { |
| 108 | +fs.writeFileSync(pathname, ""); |
| 109 | +fs.chmodSync(pathname, 0o644); |
| 110 | +} |
| 111 | + |
| 112 | +function createSecurePluginRoot(pathname: string): void { |
| 113 | +fs.mkdirSync(pathname); |
| 114 | +fs.chmodSync(pathname, 0o755); |
| 115 | +} |
| 116 | + |
107 | 117 | describe("resolveGatewayDevMode", () => { |
108 | 118 | it("detects dev mode for src ts entrypoints", () => { |
109 | 119 | expect(resolveGatewayDevMode(["node", "/Users/me/openclaw/src/cli/index.ts"])).toBe(true); |
@@ -470,8 +480,8 @@ describe("buildGatewayInstallPlan", () => {
|
470 | 480 | }, |
471 | 481 | }); |
472 | 482 | const pluginRoot = path.join(isolatedHome, "acme-secrets"); |
473 | | -fs.mkdirSync(pluginRoot); |
474 | | -fs.writeFileSync(path.join(pluginRoot, "secret-ref-resolver.js"), ""); |
| 483 | +createSecurePluginRoot(pluginRoot); |
| 484 | +writeSecurePluginEntrypoint(path.join(pluginRoot, "secret-ref-resolver.js")); |
475 | 485 | mocks.loadPluginManifestRegistry.mockReturnValue({ |
476 | 486 | diagnostics: [], |
477 | 487 | plugins: [ |
@@ -530,8 +540,8 @@ describe("buildGatewayInstallPlan", () => {
|
530 | 540 | }, |
531 | 541 | }); |
532 | 542 | const pluginRoot = path.join(isolatedHome, "acme-secrets"); |
533 | | -fs.mkdirSync(pluginRoot); |
534 | | -fs.writeFileSync(path.join(pluginRoot, "secret-ref-resolver.js"), ""); |
| 543 | +createSecurePluginRoot(pluginRoot); |
| 544 | +writeSecurePluginEntrypoint(path.join(pluginRoot, "secret-ref-resolver.js")); |
535 | 545 | mocks.loadPluginManifestRegistry.mockReturnValue({ |
536 | 546 | diagnostics: [], |
537 | 547 | plugins: [ |
@@ -658,8 +668,8 @@ describe("buildGatewayInstallPlan", () => {
|
658 | 668 | }, |
659 | 669 | }); |
660 | 670 | const pluginRoot = path.join(isolatedHome, "acme-secrets"); |
661 | | -fs.mkdirSync(pluginRoot); |
662 | | -fs.writeFileSync(path.join(pluginRoot, "secret-ref-resolver.js"), ""); |
| 671 | +createSecurePluginRoot(pluginRoot); |
| 672 | +writeSecurePluginEntrypoint(path.join(pluginRoot, "secret-ref-resolver.js")); |
663 | 673 | mocks.loadPluginManifestRegistry.mockReturnValue({ |
664 | 674 | diagnostics: [], |
665 | 675 | plugins: [ |
|