fix(memory-wiki): require admin scope for ingest [AI] (#80897) · openclaw/openclaw@aeb1ba9
pgondhi987
·
2026-05-12
·
via Recent Commits to openclaw:main
File tree
extensions/memory-wiki/src
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,6 +6,7 @@ Docs: https://docs.openclaw.ai
|
6 | 6 | |
7 | 7 | ### Fixes |
8 | 8 | |
| 9 | +- fix(memory-wiki): require admin scope for ingest [AI]. (#80897) Thanks @pgondhi987. |
9 | 10 | - memory-wiki: require write scope for Obsidian search [AI]. (#80904) Thanks @pgondhi987. |
10 | 11 | - Build: skip copied metadata for bundled plugins that are excluded from build entries, preventing update/status rebuilds from advertising missing QQ Bot runtime files. (#80925) |
11 | 12 | - Control UI/sessions: nest subagent sessions under their parent session in the session picker dropdown using a visual `└─ ` prefix, making the parent-child relationship clear. Fixes #77628. (#78623) Thanks @chinar-amrutkar. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -84,6 +84,13 @@ function findGatewayHandler(
|
84 | 84 | return registerGatewayMethod.mock.calls.find((call) => call[0] === method)?.[1]; |
85 | 85 | } |
86 | 86 | |
| 87 | +function readGatewayMethodOptions( |
| 88 | +registerGatewayMethod: ReturnType<typeof vi.fn>, |
| 89 | +method: string, |
| 90 | +): unknown { |
| 91 | +return registerGatewayMethod.mock.calls.find((call) => call[0] === method)?.[2]; |
| 92 | +} |
| 93 | + |
87 | 94 | function readRespondPayload(respond: { mock: { calls: Array<Array<unknown>> } }): unknown { |
88 | 95 | const call = respond.mock.calls[0]; |
89 | 96 | expect(call?.[0]).toBe(true); |
@@ -482,6 +489,20 @@ describe("memory-wiki gateway methods", () => {
|
482 | 489 | }); |
483 | 490 | }); |
484 | 491 | |
| 492 | +it("registers wiki.ingest with admin scope and keeps compile at write scope", async () => { |
| 493 | +const { config } = await createVault({ prefix: "memory-wiki-gateway-" }); |
| 494 | +const { api, registerGatewayMethod } = createPluginApi(); |
| 495 | + |
| 496 | +registerMemoryWikiGatewayMethods({ api, config }); |
| 497 | + |
| 498 | +expect(readGatewayMethodOptions(registerGatewayMethod, "wiki.compile")).toEqual({ |
| 499 | +scope: "operator.write", |
| 500 | +}); |
| 501 | +expect(readGatewayMethodOptions(registerGatewayMethod, "wiki.ingest")).toEqual({ |
| 502 | +scope: "operator.admin", |
| 503 | +}); |
| 504 | +}); |
| 505 | + |
485 | 506 | it("forwards ingest requests over the gateway", async () => { |
486 | 507 | const { config } = await createVault({ prefix: "memory-wiki-gateway-" }); |
487 | 508 | const { api, registerGatewayMethod } = createPluginApi(); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -26,6 +26,8 @@ import { initializeMemoryWikiVault } from "./vault.js";
|
26 | 26 | |
27 | 27 | const READ_SCOPE = "operator.read" as const; |
28 | 28 | const WRITE_SCOPE = "operator.write" as const; |
| 29 | +const ADMIN_SCOPE = "operator.admin" as const; |
| 30 | +const LOCAL_FILE_INGEST_SCOPE = ADMIN_SCOPE; |
29 | 31 | type GatewayMethodContext = Parameters< |
30 | 32 | Parameters<OpenClawPluginApi["registerGatewayMethod"]>[1] |
31 | 33 | >[0]; |
@@ -216,7 +218,7 @@ export function registerMemoryWikiGatewayMethods(params: {
|
216 | 218 | respondError(respond, error); |
217 | 219 | } |
218 | 220 | }, |
219 | | -{ scope: WRITE_SCOPE }, |
| 221 | +{ scope: LOCAL_FILE_INGEST_SCOPE }, |
220 | 222 | ); |
221 | 223 | |
222 | 224 | api.registerGatewayMethod( |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。