Skip to content

fix(plugin-sdk): harden account scope for pairing requests and challenges - #139142

Merged
obviyus merged 3 commits into
openclaw:mainfrom
SebTardif:fix/pairing-upsert-accountid
Sep 5, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
SebTardif:fix/pairing-upsert-accountid

Conversation

@SebTardif

@SebTardif SebTardif commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

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 channel or accountId fields. 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 with npm install --omit=dev. The consumer imports openclaw/plugin-sdk/channel-pairing and 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 branch 2026.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.

Scenario Current main Candidate
Conflicting account or channel Request persists in the substituted account and can be approved there Request persists in demo/alpha; other-account approval fails; bound approval succeeds
Replacement challenge writer Replacement runs; request and reply use the wrong channel Bound writer runs; request stays in demo/alpha; reply names demo
Ordinary requests and metadata Pass Pass
Repeated request code and omitted-account approval Pass Pass
Intentional cross-account policy reads Pass Pass

Focused 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.

OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs \
  src/plugin-sdk/channel-pairing.test.ts src/plugin-sdk/channel-pairing.store.test.ts \
  src/pairing/pairing-store.test.ts src/pairing/pairing-challenge.test.ts \
  src/pairing/pairing-messages.test.ts
node scripts/run-oxlint.mjs --type-aware \
  src/plugin-sdk/channel-pairing.ts src/plugin-sdk/pairing-access.ts \
  src/plugin-sdk/channel-pairing.test.ts src/plugin-sdk/channel-pairing.store.test.ts

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)
import assert from "node:assert/strict";
import { spawnSync } from "node:child_process";
import { mkdirSync } from "node:fs";
import { DatabaseSync } from "node:sqlite";
import {
  createChannelPairingController,
  readChannelAllowFromStore,
} from "openclaw/plugin-sdk/channel-pairing";
import { upsertChannelPairingRequest } from "openclaw/plugin-sdk/conversation-runtime";

const state = process.env.OPENCLAW_STATE_DIR;
assert.ok(state);
mkdirSync(state, { recursive: true });
const failures = [];
function check(name, fn) {
  try {
    fn();
    console.log(`PASS ${name}`);
  } catch (error) {
    failures.push(name);
    console.log(`FAIL ${name}: ${error.message}`);
  }
}
function cli(...args) {
  const result = spawnSync(
    process.execPath,
    ["node_modules/openclaw/openclaw.mjs", "pairing", ...args],
    { encoding: "utf8", env: process.env },
  );
  return { status: result.status, stdout: result.stdout, stderr: result.stderr };
}
function list(channel, account) {
  const result = cli("list", "--channel", channel, "--account", account, "--json");
  assert.equal(result.status, 0, result.stderr);
  return JSON.parse(result.stdout).requests;
}
function approve(channel, account, code) {
  return cli("approve", "--channel", channel, "--account", account, code);
}
const core = {
  channel: {
    pairing: {
      upsertPairingRequest: upsertChannelPairingRequest,
      readAllowFromStore: ({ channel, accountId }) =>
        readChannelAllowFromStore(channel, process.env, accountId),
    },
  },
};
const pairing = createChannelPairingController({ core, channel: "demo", accountId: " Alpha " });
check("account normalization", () => assert.equal(pairing.accountId, "alpha"));
for (const [name, extras] of [
  ["ordinary", {}],
  ["other-account", { accountId: "beta" }],
  ["other-channel", { channel: "other", accountId: "beta" }],
]) {
  const id = `sender-${name}`;
  const result = await pairing.upsertPairingRequest({
    id,
    meta: { label: name, accountId: "metadata-account" },
    ...extras,
  });
  check(`${name}: created`, () => assert.equal(result.created, true));
  const repeated = await pairing.upsertPairingRequest({ id, meta: { label: name }, ...extras });
  check(`${name}: repeat preserves code`, () =>
    assert.deepEqual(repeated, { code: result.code, created: false }),
  );
  const bound = list("demo", "alpha");
  const wrongSame = list("demo", "beta");
  const wrongOther = list("other", "beta");
  console.log(JSON.stringify({ name, bound, wrongSame, wrongOther }));
  check(`${name}: persisted bound metadata`, () =>
    assert.deepEqual(bound.find((row) => row.id === id)?.meta, { label: name, accountId: "alpha" }),
  );
  check(`${name}: other partitions empty`, () =>
    assert.deepEqual([...wrongSame, ...wrongOther], []),
  );
  for (const channel of ["demo", "other"]) {
    const wrong = approve(channel, "beta", result.code);
    check(`${name}: ${channel}/beta approval rejected`, () => assert.notEqual(wrong.status, 0));
  }
  const accepted = approve("demo", "alpha", result.code);
  check(`${name}: bound approval accepted`, () =>
    assert.equal(accepted.status, 0, accepted.stderr),
  );
  const allowed = await pairing.readAllowFromStore();
  check(`${name}: sender allowed in bound account`, () => assert.ok(allowed.includes(id)));
  check(`${name}: pending consumed`, () =>
    assert.equal(
      list("demo", "alpha").some((row) => row.id === id),
      false,
    ),
  );
}
const legacy = await pairing.upsertPairingRequest({ id: "no-account-command" });
check("approval without account follows request scope", () =>
  assert.equal(cli("approve", "demo", legacy.code).status, 0),
);
const legacyAllow = await pairing.readAllowFromStore();
check("approval without account remains in alpha", () =>
  assert.ok(legacyAllow.includes("no-account-command")),
);
let replacementCalls = 0;
const replies = [];
const challenge = await pairing.issueChallenge({
  senderId: "challenge-sender",
  senderIdLine: "Sender: challenge-sender",
  meta: { label: "challenge" },
  sendPairingReply: async (text) => {
    replies.push(text);
  },
  channel: "other",
  accountId: "beta",
  upsertPairingRequest: async (input) => {
    replacementCalls++;
    return upsertChannelPairingRequest({ ...input, channel: "other", accountId: "beta" });
  },
});
check("challenge uses bound sink", () => assert.equal(replacementCalls, 0));
check("challenge reply names bound channel", () => assert.ok(replies[0].includes("demo")));
check("challenge persists in bound account", () =>
  assert.equal(
    list("demo", "alpha").find((row) => row.id === "challenge-sender")?.meta?.label,
    "challenge",
  ),
);
check("challenge bound approval", () =>
  assert.equal(approve("demo", "alpha", challenge.code).status, 0),
);
const beta = createChannelPairingController({ core, channel: "other", accountId: "Beta" });
const betaRequest = await beta.upsertPairingRequest({ id: "legitimate-beta" });
check("explicit beta approval", () =>
  assert.equal(approve("other", "beta", betaRequest.code).status, 0),
);
const cross = await pairing.readStoreForDmPolicy("other", " Beta ");
check("intentional cross-account read", () => assert.ok(cross.includes("legitimate-beta")));
const boundAllow = await pairing.readAllowFromStore();
check("bound read stays scoped", () => assert.equal(boundAllow.includes("legitimate-beta"), false));
const db = new DatabaseSync(`${state}/state/openclaw.sqlite`, { readOnly: true });
console.log(
  JSON.stringify({
    persisted: db
      .prepare(
        "SELECT channel_key, account_id, entry FROM channel_pairing_allow_entries ORDER BY channel_key, account_id, entry",
      )
      .all(),
  }),
);
db.close();
console.log(JSON.stringify({ failures, count: failures.length }));
process.exitCode = failures.length ? 1 : 0;
Current-main package result: 14 expected failures
PASS account normalization
PASS ordinary: created
PASS ordinary: repeat preserves code
{"name":"ordinary","bound":[{"id":"sender-ordinary","code":"YK2YXALD","createdAt":"2026-09-05T15:24:27.120Z","lastSeenAt":"2026-09-05T15:24:27.122Z","meta":{"label":"ordinary","accountId":"alpha"}}],"wrongSame":[],"wrongOther":[]}
PASS ordinary: persisted bound metadata
PASS ordinary: other partitions empty
PASS ordinary: demo/beta approval rejected
PASS ordinary: other/beta approval rejected
PASS ordinary: bound approval accepted
PASS ordinary: sender allowed in bound account
PASS ordinary: pending consumed
PASS other-account: created
PASS other-account: repeat preserves code
{"name":"other-account","bound":[],"wrongSame":[{"id":"sender-other-account","code":"L8XCPWSB","createdAt":"2026-09-05T15:24:36.665Z","lastSeenAt":"2026-09-05T15:24:36.666Z","meta":{"label":"other-account","accountId":"beta"}}],"wrongOther":[]}
FAIL other-account: persisted bound metadata: Expected values to be strictly deep-equal:
+ actual - expected

+ undefined
- {
-   accountId: 'alpha',
-   label: 'other-account'
- }

FAIL other-account: other partitions empty: Expected values to be strictly deep-equal:
+ actual - expected

+ [
+   {
+     code: 'L8XCPWSB',
+     createdAt: '2026-09-05T15:24:36.665Z',
+     id: 'sender-other-account',
+     lastSeenAt: '2026-09-05T15:24:36.666Z',
+     meta: {
+       accountId: 'beta',
+       label: 'other-account'
+     }
+   }
+ ]
- []

FAIL other-account: demo/beta approval rejected: Expected "actual" to be strictly unequal to: 0
PASS other-account: other/beta approval rejected
FAIL other-account: bound approval accepted: [openclaw] Could not start the CLI.
[openclaw] Reason: No pending pairing request found for code "L8XCPWSB". Run openclaw pairing list --channel demo to list pending requests.
[openclaw] Debug: set OPENCLAW_DEBUG=1 to include the stack trace.
[openclaw] Try: openclaw doctor
[openclaw] Help: openclaw --help


1 !== 0

FAIL other-account: sender allowed in bound account: The expression evaluated to a falsy value:

  assert.ok(allowed.includes(id))

PASS other-account: pending consumed
PASS other-channel: created
PASS other-channel: repeat preserves code
{"name":"other-channel","bound":[],"wrongSame":[],"wrongOther":[{"id":"sender-other-channel","code":"3ZTJC63B","createdAt":"2026-09-05T15:24:46.336Z","lastSeenAt":"2026-09-05T15:24:46.337Z","meta":{"label":"other-channel","accountId":"beta"}}]}
FAIL other-channel: persisted bound metadata: Expected values to be strictly deep-equal:
+ actual - expected

+ undefined
- {
-   accountId: 'alpha',
-   label: 'other-channel'
- }

FAIL other-channel: other partitions empty: Expected values to be strictly deep-equal:
+ actual - expected

+ [
+   {
+     code: '3ZTJC63B',
+     createdAt: '2026-09-05T15:24:46.336Z',
+     id: 'sender-other-channel',
+     lastSeenAt: '2026-09-05T15:24:46.337Z',
+     meta: {
+       accountId: 'beta',
+       label: 'other-channel'
+     }
+   }
+ ]
- []

PASS other-channel: demo/beta approval rejected
FAIL other-channel: other/beta approval rejected: Expected "actual" to be strictly unequal to: 0
FAIL other-channel: bound approval accepted: [openclaw] Could not start the CLI.
[openclaw] Reason: No pending pairing request found for code "3ZTJC63B". Run openclaw pairing list --channel demo to list pending requests.
[openclaw] Debug: set OPENCLAW_DEBUG=1 to include the stack trace.
[openclaw] Try: openclaw doctor
[openclaw] Help: openclaw --help


1 !== 0

FAIL other-channel: sender allowed in bound account: The expression evaluated to a falsy value:

  assert.ok(allowed.includes(id))

PASS other-channel: pending consumed
PASS approval without account follows request scope
PASS approval without account remains in alpha
FAIL challenge uses bound sink: Expected values to be strictly equal:

1 !== 0

FAIL challenge reply names bound channel: The expression evaluated to a falsy value:

  assert.ok(replies[0].includes("demo"))

FAIL challenge persists in bound account: Expected values to be strictly equal:
+ actual - expected

+ undefined
- 'challenge'

FAIL challenge bound approval: Expected values to be strictly equal:

1 !== 0

PASS explicit beta approval
PASS intentional cross-account read
PASS bound read stays scoped
{"persisted":[{"channel_key":"demo","account_id":"alpha","entry":"no-account-command"},{"channel_key":"demo","account_id":"alpha","entry":"sender-ordinary"},{"channel_key":"demo","account_id":"beta","entry":"sender-other-account"},{"channel_key":"other","account_id":"beta","entry":"legitimate-beta"},{"channel_key":"other","account_id":"beta","entry":"sender-other-channel"}]}
{"failures":["other-account: persisted bound metadata","other-account: other partitions empty","other-account: demo/beta approval rejected","other-account: bound approval accepted","other-account: sender allowed in bound account","other-channel: persisted bound metadata","other-channel: other partitions empty","other-channel: other/beta approval rejected","other-channel: bound approval accepted","other-channel: sender allowed in bound account","challenge uses bound sink","challenge reply names bound channel","challenge persists in bound account","challenge bound approval"],"count":14}
Candidate package result: no failures
PASS account normalization
PASS ordinary: created
PASS ordinary: repeat preserves code
{"name":"ordinary","bound":[{"id":"sender-ordinary","code":"TTDCPAWU","createdAt":"2026-09-05T15:35:34.080Z","lastSeenAt":"2026-09-05T15:35:34.081Z","meta":{"label":"ordinary","accountId":"alpha"}}],"wrongSame":[],"wrongOther":[]}
PASS ordinary: persisted bound metadata
PASS ordinary: other partitions empty
PASS ordinary: demo/beta approval rejected
PASS ordinary: other/beta approval rejected
PASS ordinary: bound approval accepted
PASS ordinary: sender allowed in bound account
PASS ordinary: pending consumed
PASS other-account: created
PASS other-account: repeat preserves code
{"name":"other-account","bound":[{"id":"sender-other-account","code":"JWNP4UY5","createdAt":"2026-09-05T15:35:43.225Z","lastSeenAt":"2026-09-05T15:35:43.226Z","meta":{"label":"other-account","accountId":"alpha"}}],"wrongSame":[],"wrongOther":[]}
PASS other-account: persisted bound metadata
PASS other-account: other partitions empty
PASS other-account: demo/beta approval rejected
PASS other-account: other/beta approval rejected
PASS other-account: bound approval accepted
PASS other-account: sender allowed in bound account
PASS other-account: pending consumed
PASS other-channel: created
PASS other-channel: repeat preserves code
{"name":"other-channel","bound":[{"id":"sender-other-channel","code":"27CX7ENV","createdAt":"2026-09-05T15:35:51.797Z","lastSeenAt":"2026-09-05T15:35:51.798Z","meta":{"label":"other-channel","accountId":"alpha"}}],"wrongSame":[],"wrongOther":[]}
PASS other-channel: persisted bound metadata
PASS other-channel: other partitions empty
PASS other-channel: demo/beta approval rejected
PASS other-channel: other/beta approval rejected
PASS other-channel: bound approval accepted
PASS other-channel: sender allowed in bound account
PASS other-channel: pending consumed
PASS approval without account follows request scope
PASS approval without account remains in alpha
PASS challenge uses bound sink
PASS challenge reply names bound channel
PASS challenge persists in bound account
PASS challenge bound approval
PASS explicit beta approval
PASS intentional cross-account read
PASS bound read stays scoped
{"persisted":[{"channel_key":"demo","account_id":"alpha","entry":"challenge-sender"},{"channel_key":"demo","account_id":"alpha","entry":"no-account-command"},{"channel_key":"demo","account_id":"alpha","entry":"sender-ordinary"},{"channel_key":"demo","account_id":"alpha","entry":"sender-other-account"},{"channel_key":"demo","account_id":"alpha","entry":"sender-other-channel"},{"channel_key":"other","account_id":"beta","entry":"legitimate-beta"}]}
{"failures":[],"count":0}

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]>
@clawsweeper

clawsweeper Bot commented Sep 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.

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]>
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 5, 2026, 11:45 AM ET / 15:45 UTC.

ClawSweeper review

What this changes

Preserve 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
Reviewed head: 2a37d56bf4ee906b510747309fbbb10498fa8c4d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with useful regression coverage and packaged real-store evidence addressing the prior review.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The supplied external-consumer probe and before/after results exercise the public SDK, real SQLite store, and installed approval CLI at the candidate SHA, reporting wrong-account rejection and successful bound approval. Assessment uses the retained probe and result table; the omitted raw trace tail was not independently retrieved.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied external-consumer probe and before/after results exercise the public SDK, real SQLite store, and installed approval CLI at the candidate SHA, reporting wrong-account rejection and successful bound approval. Assessment uses the retained probe and result table; the omitted raw trace tail was not independently retrieved.
Evidence reviewed 12 items Introduced changes: The verified merge-base-to-head delta contains the two precedence corrections and their tests. Package versions, schemas, and unrelated base-branch changes are outside this PR’s introduced delta.
Scoped write contract: The input type already excludes channel and accountId. Applying the bound values after input restores that contract while retaining normalized reads, removals, and the explicitly cross-account policy-read helper.
Challenge owner and implementation boundary: The public challenge factory already excludes channel, accountId, and the writer from per-message input. Its callee is OpenClaw’s pairing challenge implementation; this path has no Codex runtime or protocol dependency.
Findings None None.
Security None None.

How this fits together

Channel 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]
Loading

Before merge

  • Resolve merge risk (P1) - Untyped third-party callers relying on excluded channel, accountId, or writer fields will now use the factory’s bound scope; use of that undocumented override behavior outside bundled callers is unknown.
Agent review details

Security

None.

PR surface

Source 0, Tests +134. Total +134 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 2 2 0
Tests 2 142 8 +134
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 144 10 +134

Review metrics

Metric Value Why it matters
Production versus test growth Production net 0; tests net +134 The repair reorders existing assignments; growth supplies public-boundary persistence and approval coverage.

Merge-risk options

Maintainer options:

  1. Restore the declared scope contract (recommended)
    Accept that excluded runtime override fields stop redirecting requests, while retaining separately bound controllers and explicit cross-account policy reads.

Technical review

Best 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.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied external-consumer probe and before/after results exercise the public SDK, real SQLite store, and installed approval CLI at the candidate SHA, reporting wrong-account rejection and successful bound approval. Assessment uses the retained probe and result table; the omitted raw trace tail was not independently retrieved.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The supplied external-consumer probe and before/after results exercise the public SDK, real SQLite store, and installed approval CLI at the candidate SHA, reporting wrong-account rejection and successful bound approval. Assessment uses the retained probe and result table; the omitted raw trace tail was not independently retrieved.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded SDK account-scoping defect without evidence of an affected bundled caller or active user outage.
  • merge-risk: 🚨 compatibility: JavaScript consumers relying on undocumented scope or writer overrides will observe changed behavior despite unchanged public signatures.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The supplied external-consumer probe and before/after results exercise the public SDK, real SQLite store, and installed approval CLI at the candidate SHA, reporting wrong-account rejection and successful bound approval. Assessment uses the retained probe and result table; the omitted raw trace tail was not independently retrieved.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied external-consumer probe and before/after results exercise the public SDK, real SQLite store, and installed approval CLI at the candidate SHA, reporting wrong-account rejection and successful bound approval. Assessment uses the retained probe and result table; the omitted raw trace tail was not independently retrieved.

Evidence

What I checked:

  • Introduced changes: The verified merge-base-to-head delta contains the two precedence corrections and their tests. Package versions, schemas, and unrelated base-branch changes are outside this PR’s introduced delta. (2a37d56bf4ee)
  • Scoped write contract: The input type already excludes channel and accountId. Applying the bound values after input restores that contract while retaining normalized reads, removals, and the explicitly cross-account policy-read helper. (src/plugin-sdk/pairing-access.ts:45, 2a37d56bf4ee)
  • Challenge owner and implementation boundary: The public challenge factory already excludes channel, accountId, and the writer from per-message input. Its callee is OpenClaw’s pairing challenge implementation; this path has no Codex runtime or protocol dependency. (src/plugin-sdk/channel-pairing.ts:40, 2a37d56bf4ee)
  • Current main remains affected: Fetched main still spreads input after bound channel/account fields; the challenge factory likewise allows per-message fields to replace its bound values. The final runtime diff against fetched main is exactly these two corrections. (src/plugin-sdk/pairing-access.ts:46, 952105ddd981)
  • Latest release check: The v2026.9.1 source contains the same vulnerable spread order in both SDK factories. This is not an already-shipped fix. (src/plugin-sdk/channel-pairing.ts:45, ad6fe23aecb9)
  • Approval and persistence boundary: Approval matches account and code before consuming a request or adding an allow entry. Omitted-account approval derives the destination from the stored request, and SQLite readback treats the indexed account column as authoritative. These owners are unchanged from fetched main. (src/pairing/pairing-store.ts:352, 2a37d56bf4ee)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • clawSean: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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-09-05T14:56:05.771Z sha 819acf3 :: needs real behavior proof before merge. :: none

@obviyus obviyus changed the title fix(plugin-sdk): keep scoped pairing upsert accountId fix(plugin-sdk): harden account scope for pairing requests and challenges Sep 5, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 5, 2026
@obviyus

obviyus commented Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator

landpr-approve-unrelated-red
pr: 139142
head: 2a37d56
run: 33975351480 attempt: 1
failed: checks-node-compact-small-11 job=101331059738 conclusion=failure
check: openclaw/ci-gate

@obviyus
obviyus merged commit e731a1b into openclaw:main Sep 5, 2026
215 of 219 checks passed
@obviyus

obviyus commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

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.

  • Bug: Runtime extras could replace the bound channel/account, or replace the challenge writer and misdirect its request and approval reply.
  • Fix: Both existing scope owners apply their bound values last. Ordinary metadata, request reuse, omitted-account approval, explicit cross-account reads, and scoped removal remain intact. Production growth is zero.
Before After
Conflicting input persisted and approved in demo/beta or other/beta Request persists in demo/alpha; wrong-account approval fails; bound approval succeeds
Challenge input replaced the writer and reply channel Bound writer persists the request; reply names the bound channel

CI exception: run 33975351480 failed only in checks-node-compact-small-11, job 101331059738, at subagent-spawn.authority.test.ts:116: the first sibling-drain case expected succeeded while the task remained running. The aggregate gate failed as a consequence.

The actual CI merge 3139156d5edbf4a12f93e61ab8ae03aff773cf45 differs from main parent 952105ddd981e3339775621a4e5c3dfedde5c9da only in these four pairing SDK files. The failing test and its lifecycle/task/event owners are unchanged, and the test does not invoke the changed pairing factories. The assertion was introduced in de891fdf065cd49cf1dd72cb65767614de7995df (#138910), authored by Peter Steinberger and committed by GitHub; this establishes assertion provenance, not the entire timing failure's cause. #139176 tracks the fork-runner timing repair.

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.

vincentkoc added a commit to aniruddhaadak80/openclaw that referenced this pull request Sep 5, 2026
* 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)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
…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]>
@SebTardif
SebTardif deleted the fix/pairing-upsert-accountid branch September 11, 2026 14:51
necromman pushed a commit to necromman/openclaw that referenced this pull request Sep 16, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

2 participants