fix(gateway): avoid echoing rotated device tokens

This commit is contained in:
Peter Steinberger
2026-04-27 15:09:38 +01:00
parent dacf43640a
commit 016a0b4de9
7 changed files with 59 additions and 10 deletions

View File

@@ -102,7 +102,10 @@ caller already has.
openclaw devices rotate --device <deviceId> --role operator --scope operator.read --scope operator.write
```
Returns the new token payload as JSON.
Returns rotation metadata as JSON. If the caller is rotating its own token while
authenticated with that device token, the response also includes the replacement
token so the client can persist it before reconnecting. Shared/admin rotations
do not echo the bearer token.
### `openclaw devices revoke --device <id> --role <role>`

View File

@@ -553,6 +553,10 @@ rather than the pre-handshake defaults.
reused when the client is reusing the stored per-device token.
- Device tokens can be rotated/revoked via `device.token.rotate` and
`device.token.revoke` (requires `operator.pairing` scope).
- `device.token.rotate` returns rotation metadata. It echoes the replacement
bearer token only for same-device calls that are already authenticated with
that device token, so token-only clients can persist their replacement before
reconnecting. Shared/admin rotations do not echo the bearer token.
- Token issuance, rotation, and revocation stay bounded to the approved role set
recorded in that device's pairing entry; token mutation cannot expand or
target a device role that pairing approval never granted.