Skip to content

Commit 58d55ca

Browse files
committed
fix(gateway): allow iOS watch relay commands
1 parent 2e218fd commit 58d55ca

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Docs: https://docs.openclaw.ai
3030

3131
### Fixes
3232

33+
- **iOS Watch relay commands:** allow paired iPhone nodes to advertise and invoke `watch.status` and `watch.notify` through the default Gateway policy while preserving the direct watchOS node's fixed minimal command surface.
3334
- **Swabble status config:** honor the global `--config` path when reading service status instead of silently using the default configuration.
3435
- **Gradium TTS credential egress:** reject non-HTTPS, foreign-host, and hostname-lookalike base URLs before dispatching API keys, and pin guarded transport to Gradium's documented API hostname. (#101280) Thanks @zhangguiping-xydt.
3536
- **Gateway command SecretRefs:** preserve authoritative active-snapshot values when another command secret remains unresolved, falling back locally only for missing paths instead of emitting a per-turn `secrets.resolve` failure. (#96661) Thanks @SunnyShu0925.

‎src/gateway/node-command-policy.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ describe("gateway/node-command-policy", () => {
313313
});
314314
expect(iosAllowlist.has("device.info")).toBe(true);
315315
expect(iosAllowlist.has("photos.latest")).toBe(true);
316+
expect(iosAllowlist.has("watch.status")).toBe(true);
317+
expect(iosAllowlist.has("watch.notify")).toBe(true);
316318
expect(iosAllowlist.has("system.run")).toBe(false);
317319

318320
const ipadAllowlist = resolveNodeCommandAllowlist(cfg, {
@@ -321,6 +323,8 @@ describe("gateway/node-command-policy", () => {
321323
});
322324
expect(ipadAllowlist.has("device.info")).toBe(true);
323325
expect(ipadAllowlist.has("motion.activity")).toBe(true);
326+
expect(ipadAllowlist.has("watch.status")).toBe(false);
327+
expect(ipadAllowlist.has("watch.notify")).toBe(false);
324328
expect(ipadAllowlist.has("system.run")).toBe(false);
325329

326330
const macAllowlist = resolveNodeCommandAllowlist(cfg, {
@@ -338,6 +342,8 @@ describe("gateway/node-command-policy", () => {
338342
expect(watchAllowlist.has("device.info")).toBe(true);
339343
expect(watchAllowlist.has("device.status")).toBe(true);
340344
expect(watchAllowlist.has("system.notify")).toBe(true);
345+
expect(watchAllowlist.has("watch.status")).toBe(false);
346+
expect(watchAllowlist.has("watch.notify")).toBe(false);
341347
expect(watchAllowlist.has("camera.list")).toBe(false);
342348
expect(watchAllowlist.has("system.run")).toBe(false);
343349
});

‎src/gateway/node-command-policy.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ const SMS_DANGEROUS_COMMANDS = ["sms.send", "sms.search"];
5757

5858
const TALK_PTT_COMMANDS = ["talk.ptt.start", "talk.ptt.stop", "talk.ptt.cancel", "talk.ptt.once"];
5959

60+
// The iPhone node owns the relay to its companion Watch. Keep these commands
61+
// out of the direct watchOS node surface, which has a separate fixed policy.
62+
const IOS_WATCH_RELAY_COMMANDS = ["watch.status", "watch.notify"];
63+
6064
// iOS nodes don't implement system.run/which, but they do support notifications.
6165
const IOS_SYSTEM_COMMANDS = [NODE_SYSTEM_NOTIFY_COMMAND];
6266

@@ -402,6 +406,10 @@ function resolveNodeCommandAllowlistInternal(
402406
PLATFORM_DEFAULTS.unknown,
403407
includeDesktopHostCommands: options?.includeDesktopHostCommands,
404408
});
409+
const watchRelayCommands =
410+
platformId === "ios" && normalizeDeviceMetadataForPolicy(node?.deviceFamily) === "iphone"
411+
? IOS_WATCH_RELAY_COMMANDS
412+
: [];
405413
const talkCommands = hasTalkSurface(node) ? TALK_PTT_COMMANDS : [];
406414
const pluginDefaults = listDefaultPluginNodeCommands(platformId);
407415
const approved = filterApprovedRuntimeCommands({
@@ -421,7 +429,7 @@ function resolveNodeCommandAllowlistInternal(
421429
// Dangerous plugin commands are excluded from plugin defaults. Explicit
422430
// gateway.nodes.allowCommands below can still opt them in for operators.
423431
const allow = new Set(
424-
[...base, ...talkCommands, ...pluginDefaults, ...approved, ...extra]
432+
[...base, ...watchRelayCommands, ...talkCommands, ...pluginDefaults, ...approved, ...extra]
425433
.map((cmd) => cmd.trim())
426434
.filter(
427435
(cmd) => cmd && !dangerousPluginCommands.has(cmd) && !dangerousBuiltinCommands.has(cmd),

0 commit comments

Comments
 (0)