Skip to content

fix(x): stop removed allowlist senders from reaching dispatch or replies mid-authorization - #165244

Merged
steipete merged 1 commit into
mainfrom
steipete/x-allowlist-revocation-race
Oct 5, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/x-allowlist-revocation-race

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Related: #165138

What Problem This Solves

Fixes removed X senders still reaching agent dispatch or receiving a public reply when an administrator removes them from the allowlist during asynchronous mention authorization, including thread assembly, binding re-resolution, or preparation of the reply POST. Found during the landing of #165138.

User Impact

Allowlist removals now take effect for in-flight mentions: stale authorization fails closed before dispatch and immediately before every reply POST. The ingress retry re-evaluates current policy and drops the mention once; other accounts remain unaffected.

Why This Change Was Made

The allowlist store owns an account-scoped generation fence that in-flight authorization checks at each dispatch and reply boundary. Configured allowFrom changes continue to use the existing config re-read checks. This preserves the existing owners for policy, ingress retries, and durable settlement.

Evidence

Validation recorded for commit 97105d4289e3d08965061b0d48d05265115963a3:

  • pnpm test extensions/x --maxWorkers=1: 71 tests across 9 files passed; 92.41 seconds wall time.
  • Six controlled race cases cover removal during thread assembly, binding resolution, reply resolution, and the final fetch handoff, including account isolation and exactly-once ingress settlement. The pre-fix source reproduced the binding, reply, and final-fetch defects. The final six-case authority rerun passed in 264.81 seconds wall time, including the shared worker rebuild; reported test execution was 0.302 seconds.
  • Both extension typecheck lanes, typed oxlint on the 12 touched files, oxfmt, and git diff --check passed.
  • Coordinator-run Codex autoreview of this exact head was scoped-clean through P2, with no actionable findings. The unchanged-head review is reused.

The native PR-head review checkout reran pnpm test extensions/x --maxWorkers=1: all 71 tests across 9 files passed in 209.82 seconds wall time (207.32 seconds runner time; includes 71.401 seconds of fresh shared-worker preparation).

Exact-head CI run 37251251519 passed, including openclaw/ci-gate, in 459 seconds elapsed. The checks-node-changed job used 118 seconds; these are job/run timings, not an isolated measurement of the six race cases. No CI reruns or flake retries were needed. ClawSweeper also completed review of this exact head with no actionable findings.

No documentation or changelog edits; no screenshots because there is no UI change. The race proof uses controlled fixtures, not a live X account.

Let the allowlist store invalidate account-scoped authorization snapshots
when an administrator changes stored grants. Recheck the snapshot before
agent dispatch and immediately before every reply POST. Stale ingress retries
against current policy; stale replies fail as non-retryable and not dispatched.
Keep config refresh checks and durable ingress settlement with their owners.

Prove removal during thread assembly, binding resolution, reply resolution,
and final fetch handoff with controlled promises and fake timers. Verify that
removed mentions complete once and unrelated accounts remain authorized.
The pre-fix source fails the binding, reply, and final-fetch regressions.

Validation: X suite, 71 tests across 9 files, 92.41s wall time. The final
authority-suite rerun passed all 6 tests (264.81s wall, including the shared
worker rebuild; 0.302s in reported test cases). No CI run was requested.
Both extension typecheck lanes, typed oxlint on the 12 touched files,
formatting, and whitespace checks pass. Codex autoreview is scoped-clean
through P2 with no actionable findings.
@clawsweeper

clawsweeper Bot commented Oct 5, 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.

@steipete
steipete marked this pull request as ready for review October 5, 2026 01:23
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 9:48 PM ET / October 5, 2026, 01:48 UTC (Revision 2).

ClawSweeper review

What this changes

The X channel invalidates in-flight sender authorization when administrators change stored allowlist grants and rechecks it before agent dispatch and each public reply request.

Merge readiness

✅ Ready for maintainer review

This repair remains necessary: current main lacks the authorization fence. The pinned patch has no actionable correctness or security findings, consistent with the previous unchanged-head review.

Priority: P2
Reviewed head: 97105d4289e3d08965061b0d48d05265115963a3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful race coverage, successful exact-head CI, and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER author status exempts ordinary contributor proof. Controlled tests exercise the production X authorization owners through synthetic dispatch, storage, and fetch boundaries, showing revoked-account rejection and unrelated-account success; they do not establish live X behavior. No specific unresolved introduced authority violation requires additional final-effect proof, and no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER author status exempts ordinary contributor proof. Controlled tests exercise the production X authorization owners through synthetic dispatch, storage, and fetch boundaries, showing revoked-account rejection and unrelated-account success; they do not establish live X behavior. No specific unresolved introduced authority violation requires additional final-effect proof, and no stored-data contract changes.
Evidence reviewed 10 items Pinned patch ownership: Inspected the merge-base-to-head production and test changes. The verified test merge retains the same X-only patch against its recorded main parent; unrelated endpoint drift was excluded.
Live account-scoped authorization: The allowlist owner invalidates generations before and after mutations, rejects snapshots during pending writes, and keys fences by state directory and account. Ingress checks the captured generation after asynchronous policy resolution.
Final effect checks: Monitor admission checks current authority immediately before dispatch. Reply authorization returns a synchronous guard consumed immediately before transport handoff, including each reply chunk and authentication retry. The runtime dispatcher invokes its transport without another awaited preparation step.
Findings None None.
Security None None.

How this fits together

The X plugin turns allowlisted mentions into agent requests and posts answers as public replies. Its authorization checks connect administrator-managed sender permissions to inbound dispatch and outbound network requests.

flowchart TD
  A[X mention] --> B[Sender authorization]
  C[Administrator allowlist changes] --> D[Account generation fence]
  D --> B
  B --> E[Agent dispatch]
  E --> F[Reply authorization]
  D --> F
  F --> G[Public reply request]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +110, Tests +294. Total +404 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 6 141 31 +110
Tests 6 475 181 +294
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 616 212 +404

Review metrics

Metric Value Why it matters
Production and test growth production +110 lines; tests and test support +294 lines Production growth implements the account generation fence and final authority checks; test growth consolidates fixtures and covers distinct race boundaries.

Technical review

Best possible solution:

Keep allowlist mutation fencing with the existing store owner and synchronous authority checks at dispatch and reply boundaries.

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

Yes, from source: remove a stored sender while asynchronous ingress resolution or reply authorization is suspended; current main retains the earlier allowlist result without a mutation fence. This review did not execute that scenario.

Is this the best way to solve the issue?

Yes. The patch repairs the existing allowlist owner and carries its current-authority guard to effect boundaries while preserving config policy and stored data contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5007d0ae3e47.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs a bounded authorization race in the newly added X channel without evidence of widespread current-user disruption.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied MEMBER author status exempts ordinary contributor proof. Controlled tests exercise the production X authorization owners through synthetic dispatch, storage, and fetch boundaries, showing revoked-account rejection and unrelated-account success; they do not establish live X behavior. No specific unresolved introduced authority violation requires additional final-effect proof, and no stored-data contract changes.

Evidence

What I checked:

  • Pinned patch ownership: Inspected the merge-base-to-head production and test changes. The verified test merge retains the same X-only patch against its recorded main parent; unrelated endpoint drift was excluded. (97105d4289e3)
  • Live account-scoped authorization: The allowlist owner invalidates generations before and after mutations, rejects snapshots during pending writes, and keys fences by state directory and account. Ingress checks the captured generation after asynchronous policy resolution. (extensions/x/src/allowlist.ts:59, 97105d4289e3)
  • Final effect checks: Monitor admission checks current authority immediately before dispatch. Reply authorization returns a synchronous guard consumed immediately before transport handoff, including each reply chunk and authentication retry. The runtime dispatcher invokes its transport without another awaited preparation step. (extensions/x/src/api.ts:205, 97105d4289e3)
  • Controlled race coverage: Six cases exercise administrator removal during thread assembly, binding resolution, reply resolution, and final fetch handoff. Assertions cover zero unauthorized dispatch or POST calls, unrelated-account success, and exactly-once settlement. Storage, dispatch, and transport are synthetic doubles; these are supplemental boundary tests, not live X or SQLite durability proof. (extensions/x/src/authority.test.ts:95, 97105d4289e3)
  • Existing permission and storage contracts: Current documentation defines allowlisted public replies and administrator-managed stored grants. The patch preserves configured allowFrom union behavior, stored entry shape, namespace, keys, and Gateway methods; generation objects are process-local and lifecycle-resettable. Public docs: docs/channels/x.md. (docs/channels/x.md:12, 97105d4289e3)
  • Still necessary on current main: Fetched main retains readAllowFrom and lacks the mutation-generation and final synchronous reply guards. The merged feature PR feat(x): add the X (Twitter) mentions channel plugin #165138 establishes the channel but does not supersede this repair. (extensions/x/src/allowlist.ts:42, 5007d0ae3e47)

Likely related people:

  • Peter Steinberger: Raw commit 9666c02 adds extensions/x/src/allowlist.ts:36 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9666c02c538f; files: extensions/x/src/allowlist.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-05T01:29:33.060Z sha 97105d4 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit b878998 into main Oct 5, 2026
185 checks passed
@steipete
steipete deleted the steipete/x-allowlist-revocation-race branch October 5, 2026 01:52
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…165244)

Let the allowlist store invalidate account-scoped authorization snapshots
when an administrator changes stored grants. Recheck the snapshot before
agent dispatch and immediately before every reply POST. Stale ingress retries
against current policy; stale replies fail as non-retryable and not dispatched.
Keep config refresh checks and durable ingress settlement with their owners.

Prove removal during thread assembly, binding resolution, reply resolution,
and final fetch handoff with controlled promises and fake timers. Verify that
removed mentions complete once and unrelated accounts remain authorized.
The pre-fix source fails the binding, reply, and final-fetch regressions.

Validation: X suite, 71 tests across 9 files, 92.41s wall time. The final
authority-suite rerun passed all 6 tests (264.81s wall, including the shared
worker rebuild; 0.302s in reported test cases). No CI run was requested.
Both extension typecheck lanes, typed oxlint on the 12 touched files,
formatting, and whitespace checks pass. Codex autoreview is scoped-clean
through P2 with no actionable findings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant