fix(plugins): authorize installed Codex relay runtime

This commit is contained in:
Bek
2026-08-12 21:05:22 -04:00
parent 2f42480d66
commit 26df54758c
2 changed files with 59 additions and 2 deletions
+56 -2
View File
@@ -605,6 +605,11 @@ describe("plugin sdk alias helpers", () => {
"export const codexMcpProjection = true;\n",
"utf-8",
);
fs.writeFileSync(
path.join(fixture.root, "src", "plugin-sdk", "native-hook-relay-runtime.ts"),
"export const nativeHookRelayRuntime = true;\n",
"utf-8",
);
fs.writeFileSync(
path.join(fixture.root, "src", "plugin-sdk", "qa-runtime.ts"),
"export const qaRuntime = true;\n",
@@ -673,8 +678,12 @@ describe("plugin sdk alias helpers", () => {
),
);
expect(codexSubpaths).toEqual(["codex-mcp-projection", "core"]);
expect(installedCodexSubpaths).toEqual(["codex-mcp-projection", "core"]);
expect(codexSubpaths).toEqual(["codex-mcp-projection", "core", "native-hook-relay-runtime"]);
expect(installedCodexSubpaths).toEqual([
"codex-mcp-projection",
"core",
"native-hook-relay-runtime",
]);
expect(otherSubpaths).toEqual(["core"]);
expect(installedOtherSubpaths).toEqual(["core"]);
expect(shadowCodexSubpaths).toEqual(["core"]);
@@ -860,6 +869,18 @@ describe("plugin sdk alias helpers", () => {
"plugin-sdk",
"codex-mcp-projection.js",
);
const sourceNativeHookRelayRuntimePath = path.join(
fixture.root,
"src",
"plugin-sdk",
"native-hook-relay-runtime.ts",
);
const distNativeHookRelayRuntimePath = path.join(
fixture.root,
"dist",
"plugin-sdk",
"native-hook-relay-runtime.js",
);
const sourceQaRuntimePath = path.join(fixture.root, "src", "plugin-sdk", "qa-runtime.ts");
fs.rmSync(
path.join(fixture.root, "scripts", "lib", "plugin-sdk-private-local-only-subpaths.json"),
@@ -875,6 +896,16 @@ describe("plugin sdk alias helpers", () => {
"export const codexMcpProjection = true;\n",
"utf-8",
);
fs.writeFileSync(
sourceNativeHookRelayRuntimePath,
"export const nativeHookRelayRuntime = true;\n",
"utf-8",
);
fs.writeFileSync(
distNativeHookRelayRuntimePath,
"export const nativeHookRelayRuntime = true;\n",
"utf-8",
);
fs.writeFileSync(sourceQaRuntimePath, "export const qaRuntime = true;\n", "utf-8");
const sourcePluginEntry = writePluginEntry(
fixture.root,
@@ -899,12 +930,23 @@ describe("plugin sdk alias helpers", () => {
"plugin-sdk",
"codex-mcp-projection.js",
);
const devNativeHookRelayRuntimePath = path.join(
devFixture.root,
"dist",
"plugin-sdk",
"native-hook-relay-runtime.js",
);
mkdirSafeDir(path.join(devFixture.root, "extensions"));
fs.writeFileSync(
devCodexMcpProjectionPath,
"export const devCodexMcpProjection = true;\n",
"utf-8",
);
fs.writeFileSync(
devNativeHookRelayRuntimePath,
"export const devNativeHookRelayRuntime = true;\n",
"utf-8",
);
const { packageRoot: installedCodexRoot, pluginEntry: installedCodexEntry } =
writeInstalledPluginEntry({
installRoot: path.join(makeTempDir(), ".openclaw", "npm"),
@@ -984,10 +1026,22 @@ describe("plugin sdk alias helpers", () => {
expect(fs.realpathSync(devRootAliases["openclaw/plugin-sdk/codex-mcp-projection"] ?? "")).toBe(
fs.realpathSync(devCodexMcpProjectionPath),
);
expect(fs.realpathSync(aliases["openclaw/plugin-sdk/native-hook-relay-runtime"] ?? "")).toBe(
fs.realpathSync(sourceNativeHookRelayRuntimePath),
);
expect(
fs.realpathSync(installedAliases["openclaw/plugin-sdk/native-hook-relay-runtime"] ?? ""),
).toBe(fs.realpathSync(distNativeHookRelayRuntimePath));
expect(
fs.realpathSync(devRootAliases["openclaw/plugin-sdk/native-hook-relay-runtime"] ?? ""),
).toBe(fs.realpathSync(devNativeHookRelayRuntimePath));
expect(aliases["openclaw/plugin-sdk/qa-runtime"]).toBeUndefined();
expect(otherAliases["openclaw/plugin-sdk/codex-mcp-projection"]).toBeUndefined();
expect(otherAliases["openclaw/plugin-sdk/native-hook-relay-runtime"]).toBeUndefined();
expect(installedOtherAliases["openclaw/plugin-sdk/codex-mcp-projection"]).toBeUndefined();
expect(installedOtherAliases["openclaw/plugin-sdk/native-hook-relay-runtime"]).toBeUndefined();
expect(shadowCodexAliases["openclaw/plugin-sdk/codex-mcp-projection"]).toBeUndefined();
expect(shadowCodexAliases["openclaw/plugin-sdk/native-hook-relay-runtime"]).toBeUndefined();
});
it("aliases the SSRF internal helper only for bundled local IPC owner plugins", async () => {
+3
View File
@@ -419,6 +419,7 @@ const cachedWorkspacePackageAliasMaps = new PluginLruCache<Record<string, string
const PLUGIN_SDK_PACKAGE_NAMES = ["openclaw/plugin-sdk", "@openclaw/plugin-sdk"] as const;
const CODEX_MCP_PROJECTION_PLUGIN_SDK_SUBPATH = "codex-mcp-projection";
const CODEX_SESSION_TRANSCRIPT_PLUGIN_SDK_SUBPATH = "codex-session-transcript-runtime";
const NATIVE_HOOK_RELAY_RUNTIME_PLUGIN_SDK_SUBPATH = "native-hook-relay-runtime";
const OLLAMA_CONFIGURED_LOCAL_ORIGIN_RUNTIME_PLUGIN_SDK_SUBPATH = "ssrf-runtime-internal";
const PRIVATE_QA_ONLY_PLUGIN_SDK_SUBPATHS = new Set([
"agent-runtime-test-contracts",
@@ -459,6 +460,7 @@ const PRIVATE_PLUGIN_SDK_SUBPATH_OWNERS: readonly PrivatePluginSdkSubpathOwner[]
subpaths: [
CODEX_MCP_PROJECTION_PLUGIN_SDK_SUBPATH,
CODEX_SESSION_TRANSCRIPT_PLUGIN_SDK_SUBPATH,
NATIVE_HOOK_RELAY_RUNTIME_PLUGIN_SDK_SUBPATH,
],
},
{
@@ -715,6 +717,7 @@ function readPrivateLocalOnlyPluginSdkSubpaths(packageRoot: string): string[] {
return [
...new Set([
CODEX_MCP_PROJECTION_PLUGIN_SDK_SUBPATH,
NATIVE_HOOK_RELAY_RUNTIME_PLUGIN_SDK_SUBPATH,
OLLAMA_CONFIGURED_LOCAL_ORIGIN_RUNTIME_PLUGIN_SDK_SUBPATH,
...(Array.isArray(parsed)
? parsed.filter((subpath): subpath is string => isSafePluginSdkSubpathSegment(subpath))