Enforce caller-scope subsetting in device.token.rotate
fix(gateway): enforce caller-scope subsetting in device.token.rotate
Enforce caller-scope subsetting in device.token.rotatedafd61-fix-enforce-caller-scope-subsetting-in-device-token-cve-2026-32922fixenforce caller scope subsetting device token
Committed by hydro13
commit message
fix(gateway): enforce caller-scope subsetting in device.token.rotate
device.token.rotate accepted attacker-controlled scopes and forwarded
them to rotateDeviceToken without verifying the caller held those
scopes. A pairing-scoped token could rotate up to operator.admin on
any already-paired device whose approvedScopes included admin.
Add a caller-scope subsetting check before rotateDeviceToken: the
requested scopes must be a subset of client.connect.scopes via the
existing roleScopesAllow helper. Reject with missing scope: <scope>
if not.
Also add server.device-token-rotate-authz.test.ts covering both the
priv-esc path and the admin-to-node-invoke chain.
Fixes GHSA-4jpw-hj22-2xmcEditor assessment
This commit patches CVE-2026-32922. The subject `fix(gateway): enforce caller-scope subsetting in device.token.rotate` names the method and the enforcement rule, and the body delivers real depth: it describes how attacker-controlled scopes were forwarded, gives the pairing-to-admin escalation path, names the roleScopesAllow helper, and records the new device-token-rotate-authz test file. The `Fixes GHSA-4jpw-hj22-2xmc` footer is the weak point, since it omits the colon separator and is therefore not machine-readable. That footer is the only substantive flaw; otherwise the message communicates the fix and its verification well.