惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

M
MIT News - Artificial intelligence
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
The Cloudflare Blog
IT之家
IT之家
雷峰网
雷峰网
小众软件
小众软件
博客园 - 叶小钗
博客园 - 聂微东
爱范儿
爱范儿
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
博客园 - 【当耐特】
V
V2EX
博客园_首页
T
Tailwind CSS Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: enforce device token scope containment · openclaw/op...
steipete · 2026-04-26 · via Recent Commits to openclaw:main

@@ -181,7 +181,10 @@ describe("deviceHandlers", () => {

181181

});

182182183183

it("disconnects active clients after revoking a device token", async () => {

184-

revokeDeviceTokenMock.mockResolvedValue({ role: "operator", revokedAtMs: 456 });

184+

revokeDeviceTokenMock.mockResolvedValue({

185+

ok: true,

186+

entry: { role: "operator", revokedAtMs: 456 },

187+

});

185188

const opts = createOptions("device.token.revoke", {

186189

deviceId: " device-1 ",

187190

role: " operator ",

@@ -193,6 +196,7 @@ describe("deviceHandlers", () => {

193196

expect(revokeDeviceTokenMock).toHaveBeenCalledWith({

194197

deviceId: " device-1 ",

195198

role: " operator ",

199+

callerScopes: [],

196200

});

197201

expect(opts.context.disconnectClientsForDevice).toHaveBeenCalledWith("device-1", {

198202

role: "operator",

@@ -205,7 +209,10 @@ describe("deviceHandlers", () => {

205209

});

206210207211

it("allows admin-scoped callers to revoke another device's token", async () => {

208-

revokeDeviceTokenMock.mockResolvedValue({ role: "operator", revokedAtMs: 456 });

212+

revokeDeviceTokenMock.mockResolvedValue({

213+

ok: true,

214+

entry: { role: "operator", revokedAtMs: 456 },

215+

});

209216

const opts = createOptions(

210217

"device.token.revoke",

211218

{ deviceId: "device-2", role: "operator" },

@@ -217,6 +224,7 @@ describe("deviceHandlers", () => {

217224

expect(revokeDeviceTokenMock).toHaveBeenCalledWith({

218225

deviceId: "device-2",

219226

role: "operator",

227+

callerScopes: ["operator.admin"],

220228

});

221229

expect(opts.respond).toHaveBeenCalledWith(

222230

true,

@@ -226,7 +234,10 @@ describe("deviceHandlers", () => {

226234

});

227235228236

it("treats normalized device ids as self-owned for token revocation", async () => {

229-

revokeDeviceTokenMock.mockResolvedValue({ role: "operator", revokedAtMs: 456 });

237+

revokeDeviceTokenMock.mockResolvedValue({

238+

ok: true,

239+

entry: { role: "operator", revokedAtMs: 456 },

240+

});

230241

const opts = createOptions(

231242

"device.token.revoke",

232243

{ deviceId: " device-1 ", role: "operator" },

@@ -238,6 +249,7 @@ describe("deviceHandlers", () => {

238249

expect(revokeDeviceTokenMock).toHaveBeenCalledWith({

239250

deviceId: " device-1 ",

240251

role: "operator",

252+

callerScopes: ["operator.pairing"],

241253

});

242254

expect(opts.respond).toHaveBeenCalledWith(

243255

true,

@@ -272,6 +284,7 @@ describe("deviceHandlers", () => {

272284

deviceId: " device-1 ",

273285

role: " operator ",

274286

scopes: ["operator.pairing"],

287+

callerScopes: ["operator.pairing"],

275288

});

276289

expect(opts.context.disconnectClientsForDevice).toHaveBeenCalledWith("device-1", {

277290

role: "operator",

@@ -308,6 +321,7 @@ describe("deviceHandlers", () => {

308321

deviceId: " device-1 ",

309322

role: "operator",

310323

scopes: ["operator.pairing"],

324+

callerScopes: ["operator.pairing"],

311325

});

312326

expect(opts.respond).toHaveBeenCalledWith(

313327

true,

@@ -324,6 +338,7 @@ describe("deviceHandlers", () => {

324338325339

it("rejects rotating a token for a role that was never approved", async () => {

326340

mockPairedOperatorDevice();

341+

rotateDeviceTokenMock.mockResolvedValue({ ok: false, reason: "unknown-device-or-role" });

327342

const opts = createOptions(

328343

"device.token.rotate",

329344

{

@@ -341,7 +356,12 @@ describe("deviceHandlers", () => {

341356342357

await deviceHandlers["device.token.rotate"](opts);

343358344-

expect(rotateDeviceTokenMock).not.toHaveBeenCalled();

359+

expect(rotateDeviceTokenMock).toHaveBeenCalledWith({

360+

deviceId: "device-1",

361+

role: "node",

362+

scopes: undefined,

363+

callerScopes: ["operator.pairing"],

364+

});

345365

expect(opts.context.disconnectClientsForDevice).not.toHaveBeenCalled();

346366

expect(opts.respond).toHaveBeenCalledWith(

347367

false,

@@ -351,7 +371,7 @@ describe("deviceHandlers", () => {

351371

});

352372353373

it("does not disconnect clients when token revocation fails", async () => {

354-

revokeDeviceTokenMock.mockResolvedValue(null);

374+

revokeDeviceTokenMock.mockResolvedValue({ ok: false, reason: "unknown-device-or-role" });

355375

const opts = createOptions("device.token.revoke", {

356376

deviceId: "device-1",

357377

role: "operator",

@@ -363,7 +383,7 @@ describe("deviceHandlers", () => {

363383

expect(opts.respond).toHaveBeenCalledWith(

364384

false,

365385

undefined,

366-

expect.objectContaining({ message: "unknown deviceId/role" }),

386+

expect.objectContaining({ message: "device token revocation denied" }),

367387

);

368388

});

369389