Repository navigation
fix(openclaw-id): delegated owner devices can escape revocation or regain removed capabilities - #193990
Conversation
…ent authority for re-adds (openclaw-3c7)
…gain removed capabilities OpenClaw-Publication: d77653aa-2243-49dd-8290-544278dfad32
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
OpenClaw-Publication: d13c5bfb-757b-4950-81db-9a7632a90997
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves delegated-device approval lineage and requires device grants to use the enclosing membership change’s current authority. Example: D1 approves D2, D2 re-certifies itself, and the recovery-kit root revokes D1.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes authority bypasses still present on current main; no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe protocol authority validates signed membership changes and returns updated membership plus removal events; the Gateway persists that state and enforces connection and token removal. flowchart TD
A[Signed membership change] --> B[Gateway authority queue]
B --> C[Protocol grant validation]
C --> D[SQLite membership state]
D --> E[Admission and snapshots]
C --> F[Removal events]
F --> G[Connections and device tokens]
Technical reviewBest possible solution: Keep grant validation in addOwnerDevice, preserve approval lineage, and retain recovery-kit authority to restore access. Do we have a high-confidence way to reproduce the issue? Current-main source exposes both bypasses, and the supplied Gateway comparison records the failing and repaired behavior; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch repairs the producer of invalid grants, reuses the existing descendant calculation, and preserves legitimate enrollment and root recovery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e5253a3b0563. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +62, Tests +197, Docs +25, Other +3. Total +287 across 7 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed November 6, 2026, 8:45 AM ET / 13:45 UTC (Revision 3). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Related: #191469 (security review of the protocol package)
What Problem This Solves
Fixes: a delegated owner device can survive revoking the device that approved it, or get back capabilities that were taken away. To do this it re-adds itself (or another device) with a new certificate.
User Impact
User impact: revoking an owner device now reliably removes every device it approved, and lowering a device's capabilities stays in effect until the recovery kit raises them again. Nothing has shipped yet; this tightens the v1-draft protocol before Gateways store membership state.
Why This Change Was Made
addOwnerDevicehad two gaps found in the #191469 security review:approved_byfrom whoever signed the replacement certificate. A device withapprove_devicecould re-certify itself (or a sibling) and move out of its approver's removal cascade.Protocol changes (all in
add_owner_device):wrong_signerotherwise). The authority behind a grant is the current authority of the change. Every caller I found already signs both with the same key.target_mismatchotherwise). An earlier version of this fix only preserved lineage. Independent review showed that then let a device attach its own peer key to an unrelated root-approved device and survive revocation. This rule closes that.approved_byand still cannot raise capabilities. R can still re-add any device, raise capabilities, and re-anchor a device underroot.Docs:
statements.mdandenrollment.mdnow describe these rules.README.mdstates that the guarantees assume the loader and Service Worker delivery path is trusted (review item 3).K_srv+K_gwresidual risk is now an accepted v1 limitation. The text corrects the claim that aK_gw-signed nonce answer would close it, and notes that an oldK_gwcan also triggerowner_reset(review item 4).Out of scope: separate from this PR, the client freshness marker can lower its stored
binding_seq. That is a pre-existing bug, tracked as a separate issue.Test-line allocation:
config/test-lines-allocations/openclaw-id-owner-device-lineage.txtgrants 197 lines, exactly this PR's net test growth. These are security regressions for the review findings and the peer-graft bypass, and no existing test covered them.Evidence
Live Gateway trace through the #192345 tunnel ingress (before and after)
#192345 (tunnel transport and relayed-device Gateway auth) is not on
mainyet, so I built it together with this PR and ran one scripted scenario against a real Gateway. I ran it on two builds:4f86c5741e84merged with this PR's head40441d9933f9. The merge was clean.4f86c5741e84alone.The script is a throwaway and is not committed.
What the scenario uses:
createGatewaySuiteHarness, token auth,gateway.openclawId.enabled)POST /_openclaw-id/v1/statements)openclawId.authoritysubmitwith the Gateway tokenScenario:
approved_bymoves off D1approved_bystays D1target_mismatchwrong_signer, caps stay["approve_device"]devices: 1, connectionsClosed: 0devices: 2, connectionsClosed: 1token-revoked/_openclaw-id/v1/membershipnot_owner_deviceroot(recovery)After recovery, D2's old Gateway device identity is asked to re-pair ("pairing required: device is asking for a higher role than currently approved"). Removal revoked that identity's paired tokens, and this pairing behavior comes from #192345, not from this PR.
Not exercised:
runsCancelledis 0 in both builds)An earlier version of this section had a service-level trace on the in-memory store with recorded effect hooks. The live trace above supersedes it.
Protocol tests
approval-lineage.test.ts(9 tests throughsubmitStatement) covers:main, 7 of these 9 tests fail (the R re-anchor and ancestor-update cases are guards that pass both ways).pnpm vitest run packages/openclaw-id-protocol: 25 files, 178 tests pass. The new file takes 3.0s wall time with--maxWorkers=1.oxlinton the changed files and a package-scopedtsgotypecheck are clean;run-format --checkandgit diff --checkpass.40441d9933f9.