Tighten phone-control mutation authorization [AI] (#87150)

* fix: require admin authorization for phone control mutations

* addressing codex review

* addressing codex review

* addressing ci

* addressing ci

* test: restore provider registry mock isolation

* docs: add changelog entry for PR merge
This commit is contained in:
Pavan Kumar Gondhi
2026-05-28 16:00:01 +05:30
committed by GitHub
parent 629fc2f8f0
commit 91a4635bdc
11 changed files with 209 additions and 19 deletions

View File

@@ -160,6 +160,12 @@ export function validatePluginCommandDefinition(
: "Command requiredScopes contains unknown operator scope";
}
}
if (
command.exposeSenderIsOwner !== undefined &&
typeof command.exposeSenderIsOwner !== "boolean"
) {
return "Command exposeSenderIsOwner must be a boolean";
}
if (command.channels !== undefined) {
if (!Array.isArray(command.channels)) {
return "Command channels must be an array of channel ids";
@@ -308,7 +314,12 @@ export function pluginCommandSupportsChannel(
export function registerPluginCommand(
pluginId: string,
command: OpenClawPluginCommandDefinition,
opts?: { pluginName?: string; pluginRoot?: string; allowReservedCommandNames?: boolean },
opts?: {
pluginName?: string;
pluginRoot?: string;
allowReservedCommandNames?: boolean;
allowOwnerStatusExposure?: boolean;
},
): CommandRegistrationResult {
// Prevent registration while commands are being processed
if (isPluginCommandRegistryLocked()) {
@@ -363,6 +374,9 @@ export function registerPluginCommand(
pluginId,
pluginName: opts?.pluginName,
pluginRoot: opts?.pluginRoot,
...(opts?.allowOwnerStatusExposure === true && normalizedCommand.exposeSenderIsOwner === true
? { trustedOwnerStatusExposure: true as const }
: {}),
});
logVerbose(`Registered plugin command: ${key} (plugin: ${pluginId})`);
return { ok: true };