fix: gate diagnostics command to owners · openclaw/openclaw@170bf72
joshavant
·
2026-06-25
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -574,7 +574,7 @@ describe("diagnostics command", () => {
|
574 | 574 | }); |
575 | 575 | |
576 | 576 | it("requires an owner for diagnostics", async () => { |
577 | | -const { handleDiagnosticsCommand } = createDiagnosticsHandlerForTest(); |
| 577 | +const { execCalls, handleDiagnosticsCommand } = createDiagnosticsHandlerForTest(); |
578 | 578 | const result = await handleDiagnosticsCommand( |
579 | 579 | buildDiagnosticsParams("/diagnostics", { |
580 | 580 | command: { |
@@ -586,6 +586,7 @@ describe("diagnostics command", () => {
|
586 | 586 | ); |
587 | 587 | |
588 | 588 | expect(result).toEqual({ shouldContinue: false }); |
| 589 | +expect(execCalls).toHaveLength(0); |
589 | 590 | }); |
590 | 591 | |
591 | 592 | it("routes confirmations back to the Codex diagnostics handler without repeating the preamble", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -11,6 +11,7 @@ import type { InteractiveReply, MessagePresentationAction } from "../../interact
|
11 | 11 | import { executePluginCommand, matchPluginCommand } from "../../plugins/commands.js"; |
12 | 12 | import type { PluginCommandDiagnosticsSession, PluginCommandResult } from "../../plugins/types.js"; |
13 | 13 | import type { ReplyPayload } from "../types.js"; |
| 14 | +import { rejectNonOwnerCommand } from "./command-gates.js"; |
14 | 15 | import { |
15 | 16 | buildCurrentOpenClawCliCommand, |
16 | 17 | buildCurrentOpenClawCliExecEnv, |
@@ -95,6 +96,10 @@ async function handleDiagnosticsCommandWithDeps(
|
95 | 96 | ); |
96 | 97 | return { shouldContinue: false }; |
97 | 98 | } |
| 99 | +const nonOwner = rejectNonOwnerCommand(params, DIAGNOSTICS_COMMAND); |
| 100 | +if (nonOwner) { |
| 101 | +return nonOwner; |
| 102 | +} |
98 | 103 | if (isCodexDiagnosticsConfirmationAction(args)) { |
99 | 104 | const codexResult = await executeCodexDiagnosticsAddon(params, args); |
100 | 105 | const reply = codexResult |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。