Skip to content

fix: ignore a captured revocation after the same key is approved again - #192230

Closed
SebTardif wants to merge 9 commits into
openclaw:mainfrom
SebTardif:fix/id-revocation-replay
Closed

SebTardif wants to merge 9 commits into
openclaw:mainfrom
SebTardif:fix/id-revocation-replay

Conversation

@SebTardif

@SebTardif SebTardif commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A captured OpenClaw ID revocation can delete a device again after an owner approves that same key back. Membership changes carry a sequence number, so a second submit fails. A revocation does not, and the mailbox accepts it.

User Impact

Submitting the same signed revocation again does not remove an owner device or browser that was approved after that signature was captured. A new signature still revokes, including when the signer's clock is behind the certificate. A revocation for a key the claw no longer lists stays a no-op.

Why This Change Was Made

applyRevocation used to delete whatever fingerprint was listed, so the old signature removed a later approval. Comparing issued_at with the certificate clock was the wrong guard: a certificate may be up to five minutes ahead of Gateway time, and a fresh revocation then looked older than the certificate. The signature that actually removed a key is remembered instead. The same bytes are a no-op. A different signature still revokes, and a revocable owner still takes every device it currently approved.

Evidence

Terminal output from the identity protocol package at ec20db33baa1, through submitStatement:

revocation > keeps a newer approval when an older revocation is submitted again
revocation > still removes every device a revocable owner approved
revocation > honours a revocation that is newer on the signer's clock than the add
revocation > removes a device with every device it approved, transitively, and disconnects them

Real behavior proof

  • Behavior or issue addressed: Submitting a previously accepted revocation through the mailbox removed an owner device, or a member browser, that had been approved again after that revocation was signed.
  • Real environment tested: macOS, Node, packages/openclaw-id-protocol at ec20db3. The reference membership model is the owner of this rule. The Gateway does not call it yet.
  • Exact steps or command run after this patch: From the package, ran the allowlist suite. One case replays the same signed revocation after a newer certificate and expects no events. One revokes an owner by peer key while a descendant certificate is 120 seconds ahead, and expects every device removed. One revokes a browser at WORLD_NOW + 1 while Gateway now is WORLD_NOW + 120, and expects the browser peer keys cleared.
  • Evidence after fix: terminal output from that run:
revocation > keeps a newer approval when an older revocation is submitted again
revocation > still removes every device a revocable owner approved
revocation > honours a revocation that is newer on the signer's clock than the add
revocation > removes a device with every device it approved, transitively, and disconnects them
  • Observed result after fix: The replay returns no events and leaves the re-approved device listed. A new signature still removes the owner and every device it approved, even when a descendant certificate is two minutes ahead. A browser revocation still clears that browser when the Gateway clock is ahead of the signer. A second submit while the key is already gone still changes nothing.
  • What was not tested: A live Gateway or Discovery mailbox. No route calls submitStatement yet.

A membership change replay fails once its sequence moves. A revocation
has no sequence, so a captured statement removed an owner device or
browser again after a later approval. The revocation now has to be at
least as new as the current certificate, or as the time the browser
was added.

The allowlist suite covers a mailbox replay after re-approval.

Signed-off-by: Sebastien Tardif <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added the clawsweeper:intake:bug Preliminary submission classification; full source review pending. label Nov 3, 2026
The merged tree is over the test-line ceiling, so any added test line fails.
The re-approval replay stays, and the allowlist cap cases now share one case.

Signed-off-by: Sebastien Tardif <[email protected]>
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR remembers successfully applied revocation signatures so replaying one cannot remove a subsequently approved device.

Example: device-1 revokes device-2, approves device-2 again, and the original signed revocation arrives through the mailbox again.

  • Before: device-2 is removed again and disconnect and token-invalidation events are emitted.
  • After: The remembered signature produces no events and device-2 remains approved.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) No discrete introduced bug remains, and the prior test-placement finding is fixed; unit-only evidence does not clear the authority proof gate.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Replaying an already accepted revocation can remove a device after its owner approves the same key again.
Reason: The replay repair has clear value, while its lifetime-history contract requires the decision recorded above.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this PR open: it addresses a source-confirmed replay defect still present on main, and the previous test-placement finding is resolved; lifetime signature retention needs the protocol owner's decision.

Priority: P2
Reviewed head: ec20db33baa106b71a875bdffb0bacbac853ba04
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should the reference authority retain every successfully applied revocation signature for its entire lifetime?
  • Recommendation: Approve lifetime retention: Accept the documented ledger lifetime as the draft protocol contract, preserving replay protection without clock comparisons.
  • Why: This changes the deliberately history-free authority model into an accumulating replay ledger; the contributor documents the change, but no protocol-owner approval appears in the discussion.

Before merge

  • Add real behavior proof - Authority-chain proof required: the supplied current-head macOS/Node evidence runs protocol unit tests through submitStatement and observes returned state and events, without a consumer enforcing access removal. Supply redacted logs or terminal output showing reapproved owner and member-browser access surviving captured replay, fresh revocations removing targets and descendants despite supported clock skew, and removed or unauthorized principals rejected before Gateway I/O; if the consumer persists authority state, demonstrate replay protection surviving recovery. The staging evidence in feat(openclaw-id): add protocol contracts package #191469 predates this patch. Redact API keys, IPs, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security review attention item - Current-signer verification remains intact, but replay suppression changes the authority contract governing device removal.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Tests

  • Missing end-to-end proof: Missing current-head consumer proof of replay-safe access and final-effect rejection after fresh revocation; no red-on-base regression run is supplied.
Agent review details

How this fits together

The private OpenClaw ID protocol package verifies signed membership writes and returns in-memory authority state plus events; Gateway consumers own persistence, admission, disconnection, and token invalidation.

flowchart LR
  A[Signed membership writes] --> B[Schema and current signer verification]
  B --> C[Revocation signature ledger]
  C --> D[Allowlist transition]
  D --> E[Returned authority state]
  D --> F[Gateway effect events]
Loading

Technical review

Best possible solution:

Keep replay deduplication in the existing authority owner, with an approved signature-lifetime contract and demonstrated access enforcement.

Do we have a high-confidence way to reproduce the issue?

Source inspection establishes the sequence: revoke device-2, approve the same key again, then resubmit the original signature while its signer remains authorized; current main removes device-2 again, although no reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Signature deduplication repairs the existing authority operation without competing policy or unreliable clock ordering, preserves cascade removal, and leaves only the ledger-lifetime choice to its owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 206d54934a3d.

Provenance checked

  • Revocation application and history-free authority changes intended behavior with a stated reason (ed57ed7: feat(openclaw-id): add protocol contracts package #191469 deliberately introduced a current allowlist without revocation lists; removing a device also removes its approval descendants.)
  • Published membership snapshots keeps the original intent (ed57ed7: Snapshots expose current allowlisted devices and granted capabilities rather than revocation history; this PR keeps the new signature ledger out of snapshots.)

Testing

Proof path: unit tests only.

Security

Needs attention: Current-signer verification remains intact, but replay suppression changes the authority contract governing device removal.

Evidence

What I checked:

Likely related people:

  • Josh Lehman: Raw commit ed57ed7 adds packages/openclaw-id-protocol/src/authority/apply.ts:90 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ed57ed752e35; files: packages/openclaw-id-protocol/src/authority/apply.ts)

PR surface

Source +108, Tests -10, Docs +13. Total +111 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 129 21 +108
Tests 1 56 66 -10
Docs 3 25 12 +13
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 210 99 +111

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A concrete replay defect exists in the newly merged reference protocol, with no current production Gateway consumer established.
  • merge-risk: 🚨 security-boundary: The patch changes which signed revocations remove devices and therefore affect admission, disconnection, and token invalidation.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add final-effect proof for reapproved devices surviving replay and freshly revoked or unauthorized devices losing access before Gateway I/O.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-11-03T20:40:13.120Z sha b72755e :: needs real behavior proof before merge. :: [P1] Preserve the full cascade after selecting a revocable owner | [P1] Compare member approvals and revocations using compatible ordering | [P3] Retain the independent assertions removed for the test budget
  • reviewed 2026-11-03T21:17:11.782Z sha d9b7375 :: needs real behavior proof before merge. :: [P1] Preserve fresh revocations under supported device clock skew | [P3] Restore independent capacity and member-inactivity coverage
  • reviewed 2026-11-03T21:59:53.522Z sha f28dd19 :: needs real behavior proof before merge. :: [P3] Keep the new regression cases inside the test-line budget | [P3] Update the reference authority's remaining no-history contract
  • reviewed 2026-11-03T22:26:49.624Z sha 9b740c2 :: needs real behavior proof before merge. :: [P3] Keep executable regression cases inside the counted test suite

Reviewed November 3, 2026, 6:00 PM ET / 23:00 UTC (Revision 5).

A peer-key revocation of a still-current owner removes every device that
owner approved, including one with a newer certificate. A browser approval
is the signed issued_at of the add, so a revocation from that same clock
still disconnects the browser when the Gateway clock is ahead.

Signed-off-by: Sebastien Tardif <[email protected]>
The assertion-safety ratchet counts a type assertion unless the
SAFETY comment is on the line above it.

Signed-off-by: Sebastien Tardif <[email protected]>
@SebTardif

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

CI is green on d9b7375. This head fixes the two blocked paths from the review of b72755e.

A peer-key revocation of a still-current owner removes the full approval cascade, including a descendant with a newer certificate. A browser approval time is the signed issued_at of the add, so a revocation from that clock still applies when the Gateway clock is ahead. The type assertion has its SAFETY comment on the line above it.

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 3, 2026
A certificate signed within the allowed skew can be newer than a
revocation from another device. That must not veto a fresh signature.
The bytes that already removed a key are remembered, so a replay cannot
delete a later approval, and a new signature still revokes.

The owner-device, member, and browser cap cases and the idle member
browser case are back, with a test-line allocation for the growth.

Signed-off-by: Sebastien Tardif <[email protected]>
The merged tree is already over the test-line ceiling, so any added
test lines fail that ratchet. Drop the allocation and keep the replay,
full cascade, and browser clock cases registered by the allowlist suite.

Signed-off-by: Sebastien Tardif <[email protected]>
@SebTardif SebTardif changed the title fix: ignore a revocation older than the current approval fix: ignore a captured revocation after the same key is approved again Nov 3, 2026
@SebTardif

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

CI is green on f28dd19. This head remembers the signature that removed a key, instead of comparing clocks.

The same signed revocation is a no-op after that key is approved again. A different signature still revokes, including when a descendant certificate is two minutes ahead and when the Gateway clock is ahead of the browser revocation. A revocable owner still takes every device it currently approved.

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 3, 2026
The enrollment table still said a revocation keeps no history. The
authority remembers the signature that removed a listed key for the life
of that state, and the snapshot still omits it. This draft does not expire
those signatures.

Signed-off-by: Sebastien Tardif <[email protected]>
@SebTardif

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

CI is green on 9b740c2. The enrollment table and the revocation type now say the signature that removed a listed key stays on the authority state for its life. This draft does not expire those signatures, and the published snapshot does not include them. A shorter bound is still an owner decision. I did not add one.

The replay cases stay registered by the allowlist suite. Moving them into a counted test file adds lines. Current main is 294 test lines over the ceiling (6443395 against 6443101), and a positive delta fails that check even with a matching allocation. The zero-delta layout is what keeps the required ratchet green.

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 3, 2026
The three replay cases now sit in the counted owner suite. Shared
signing helpers live on the world builder, and the suite is 10 lines
shorter than main, so the test-line ratchet stays green while main is
over its ceiling.

Signed-off-by: Sebastien Tardif <[email protected]>
@SebTardif

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

CI is green on ec20db3. The three replay cases now sit in the allowlist suite, which is the counted owner file. Shared signing helpers live on the world builder. That suite is 10 lines shorter than main, so the test-line delta is negative. An allocation cannot cover main's inherited overage: the checker fails any positive delta while the tree is over the ceiling.

The signature ledger and its lifetime are unchanged. A shorter bound is still the protocol owner's decision. No Gateway route calls submitStatement.

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 3, 2026
@jalehman

jalehman commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Thanks @SebTardif. You found a real bug: a captured revocation could remove a device again after an owner approved it back. This PR is what prompted the fix, and we've credited you there.

We're closing this in favor of #193146, which fixes the same replay differently. Here's why, for the record.

Why not a list of applied revocations. This PR remembers every revocation signature that removed a key. That list only grows: one entry per removal, kept for the life of the claw. On 2026-11-02 we deliberately stopped keeping history after the old revoked list outgrew the 256-entry statement limit. The claw now keeps only current state. A growing list would bring that problem back, and a stolen owner device could grow it on purpose by approving and revoking keys in a loop.

What #193146 does instead. A revocation covers only what its signer saw:

  • A Revocation now names its claw and the membership seq the signer last read.
  • Every listed key remembers the seq at which it was listed. Re-adding a key that is still listed keeps its original number.
  • A revocation removes a key only if the key was listed at or before the revocation's seq. Devices that key approved go with it, as before.
  • Approving a key again creates a new listing that the old signature never covered. Replaying the old revocation is refused with seq_conflict and changes nothing. A revocation signed after the re-approval still removes the key.

The claw needs nothing beyond one number per listed key, so its storage stays within the existing caps. The same PR also bounds invites: each lasts at most a week, a claw keeps at most 100, and expired ones are deleted.

Your test cases helped shape this. Thank you again.

@jalehman jalehman closed this Nov 5, 2026
jalehman added a commit that referenced this pull request Nov 5, 2026
…at was approved again (#193146)

A Revocation now names its claw and the membership seq its signer saw, and every
listed key records the seq at which it was listed (re-adding a listed key keeps
it). A revocation removes only keys listed at or before its seq, together with
every device they approved; a key listed again later is refused as seq_conflict,
so replaying captured bytes changes nothing and no list of past revocations is
kept.

Invites stay bounded the same way: a cap may expire at most a week after
registration, a claw keeps at most 100 invites, spent records are deleted before
counting, and removing an owner device deletes the open invites it registered.

Prompted by #192230 (thanks @SebTardif).
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 5, 2026
…at was approved again (openclaw#193146)

A Revocation now names its claw and the membership seq its signer saw, and every
listed key records the seq at which it was listed (re-adding a listed key keeps
it). A revocation removes only keys listed at or before its seq, together with
every device they approved; a key listed again later is refused as seq_conflict,
so replaying captured bytes changes nothing and no list of past revocations is
kept.

Invites stay bounded the same way: a cap may expire at most a week after
registration, a claw keeps at most 100 invites, spent records are deleted before
counting, and removing an owner device deletes the open invites it registered.

Prompted by openclaw#192230 (thanks @SebTardif).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants