Repository navigation
fix(plugin-sdk): harden account scope for pairing requests and challenges - #139142
Conversation
createScopedPairingAccess spread input after channel/accountId, so a runtime extra accountId remapped the pairing request to another account. Spread input first, then force the scoped ids. Signed-off-by: Sebastien Tardif <[email protected]>
|
🦞👀 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. |
checks-node-compact-small-11 failed on subagent-spawn.authority.test.ts (running vs succeeded). This PR only changes plugin-sdk pairing-access. Signed-off-by: Sebastien Tardif <[email protected]>
|
Codex review: blocked before merge. Reviewed September 5, 2026, 11:45 AM ET / 15:45 UTC. ClawSweeper reviewWhat this changesPreserve a pairing controller’s bound channel, account, and challenge writer when JavaScript callers supply conflicting fields, with persistence and approval regression coverage. Merge readiness⛔ Blocked before merge - 1 item remains Still necessary: current main and the latest release retain the scope-override defect. No blocking correctness findings; the updated packaged SDK/SQLite evidence addresses the previous proof request. Priority: P2 Review scores
Verification
How this fits togetherChannel plugins use pairing helpers to record unapproved senders and return approval codes. The shared SQLite store matches approvals to channel accounts and maintains the sender lists used for DM access. flowchart TD
A[Plugin pairing request] --> B[Bound channel and account]
B --> C[Pending SQLite request]
C --> D[Pairing code reply]
C --> E[Account-matched approval]
E -->|Match| F[Approved sender list]
E -->|Wrong account or expired| G[No approval]
F --> H[DM access check]
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +134. Total +134 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the existing SDK factories as the scope owners, preserve explicit cross-account operations, and retain the ordinary-call and persisted-approval compatibility coverage. Do we have a high-confidence way to reproduce the issue? Yes: current main’s spread order deterministically permits conflicting runtime fields, and the supplied baseline package trace demonstrates wrong-account persistence. This review did not execute the code. Is this the best way to solve the issue? Yes: correcting precedence in both binding factories repairs the owner boundary without adding an API or migration; the downstream store cannot recover the caller’s intended bound scope. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 952105ddd981. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
landpr-approve-unrelated-red |
|
Thanks @SebTardif! Merged as e731a1b. Proof: SDK hardening through the installed public package, real isolated SQLite store, and installed pairing CLI. Baseline main redirected requests and allowed approval in the substituted account; the exact candidate passed every scenario. All 29 focused tests, formatting, type-aware lint, both full package builds, and tarball checks passed. Independent exact-head review found no issues and accepted the complete behavior proof.
CI exception: run 33975351480 failed only in checks-node-compact-small-11, job 101331059738, at The actual CI merge Recent main-push failures did not contain this same assertion failure, so the automatic main-run exception was unavailable. Landing used the guarded exact-failure approval under the standing direction to land past verified unrelated failures. No unrelated code or test was changed here. |
* origin/main: (46 commits) fix(gateway): keep chat metadata responsive across auth refresh (openclaw#139192) fix(doctor): keep Workshop relocation lint read-only (openclaw#139193) perf(ui): retain unchanged forwarded avatar publications (openclaw#139181) fix(config): guide exec policy migration repairs (openclaw#139143) test(i18n): refresh representative Watch key (openclaw#139197) fix(agents): preserve recovered scheduled-run outcomes (openclaw#139037) refactor(acp): simplify pending operation accounting (openclaw#139189) fix(plugin-sdk): harden account scope for pairing requests and challenges (openclaw#139142) perf(gateway): avoid redundant PR landing ancestry checks (openclaw#139186) perf(ui): release captured audio cache leases directly (openclaw#139174) fix(skills): validate names in library forms (openclaw#139184) fix(sessions): reduce cold catalog listing delays (openclaw#139146) perf(cron): scan preserved action output once (openclaw#139163) fix(agents): keep fresh tool results readable under context pressure (openclaw#139165) fix(compaction): heartbeat sessions ignore the active transcript byte cap (openclaw#136533) perf(agents): reuse snapshotted web search result rows (openclaw#139162) fix(onboarding): keep Tauri setup recoverable and verify model results (openclaw#139140) fix(memory): rank indexed sessions by source activity (openclaw#139112) perf(terminal): avoid rebuilding sanitized link fallbacks (openclaw#139159) perf(agents): bound retained tool result projection data (openclaw#139157) ...
…nges (openclaw#139142) Keep the channel, normalized account, and challenge store writer bound by the public pairing helpers when JavaScript callers supply conflicting runtime fields. Retain ordinary metadata, request reuse, approval without an explicit account, and intentional cross-account policy reads. Replace private argument-only coverage with public-controller tests against real SQLite state and verify installed-package creation, listing, and approval. Co-authored-by: Ayaan Zaidi <[email protected]>
…nges (openclaw#139142) Keep the channel, normalized account, and challenge store writer bound by the public pairing helpers when JavaScript callers supply conflicting runtime fields. Retain ordinary metadata, request reuse, approval without an explicit account, and intentional cross-account policy reads. Replace private argument-only coverage with public-controller tests against real SQLite state and verify installed-package creation, listing, and approval. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit e731a1b)
What Problem This Solves
SDK hardening: a public pairing controller bound to one channel/account could store requests in a different account when a JavaScript caller supplied extra
channeloraccountIdfields. A challenge could also replace the bound writer and change its notification scope or approval reply. The declared inputs already exclude these fields; no bundled caller supplying them was found.Why This Change Was Made
Both existing scope owners now apply their bound values after the caller's fields. The store continues to own persistence and approval. This restores the declared contract without adding a sanitizer, wrapper, schema, configuration, or policy.
The private argument-only test is replaced with public-controller tests using real SQLite state. The challenge hook test covers conflicting runtime fields. Existing runtime fixtures now use the canonical test factory instead of double type assertions.
User Impact
Pairing requests remain in the controller's normalized account, and an explicit approval for another account cannot consume them. Ordinary metadata, repeated request codes, challenge callbacks, approval without
--account, and intentional cross-account policy reads retain their existing behavior.This proves the public SDK path and installed CLI against isolated state. It does not claim a live messaging-provider regression or proof of approval notification delivery.
Evidence
Baseline main:
31903060a5d4a98ccd367aa6f15e66339a3ddcba.Candidate:
2a37d56bf4ee906b510747309fbbb10498fa8c4d.Each source produced its own complete package through
node scripts/package-openclaw-for-docker.mjs --allow-unreleased-changelog. Each tarball was installed into a separate external JavaScript consumer withnpm install --omit=dev. The consumer importsopenclaw/plugin-sdk/channel-pairingand the real public store export, then runs the installed CLI to list and approve requests. Separate CLI processes reopen the same isolated SQLite database; a final physical table query records approval partitions.Package metadata remains as built: baseline
2026.9.1, candidate branch2026.8.1. The exact source commits above, retained build stamps, and independent fresh stores identify the executions. This PR does not change package versions or schemas.demo/alpha; other-account approval fails; bound approval succeedsdemo/alpha; reply namesdemoFocused validation: 29 tests pass across the controller, store, challenge, and reply suites. The four regression cases fail on baseline main. Tests cover reopening the database, preexisting same-sender requests in another account, approval, scoped removal, and hook scope. Formatting and type-aware lint pass. Both complete package builds and tarball integrity checks pass.
Production delta: 0 lines. Test delta: +134 lines. No public signature changes. The latest review's real-store proof request and rank-up suggestion are addressed below with the probe source and persisted results.
External JavaScript probe (run from each installed consumer)
Current-main package result: 14 expected failures
Candidate package result: no failures