mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-03 06:34:09 +00:00
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:
committed by
GitHub
parent
629fc2f8f0
commit
91a4635bdc
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user