Skip to content

fix(agents): reject forged plugin owner authority - #104872

Merged
steipete merged 3 commits into
mainfrom
codex/conversation-identity-ingress
Aug 26, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/conversation-identity-ingress

Conversation

@steipete

@steipete steipete commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Public plugin ingress could claim owner privileges and reach owner-only tools.

Repair

Strip owner authority from public ingress; only an exact live trusted plugin/channel capability injected by its host can preserve authenticated owner state. Discord owners, lifecycle invalidation, recovery boundaries, and audit-disabled operation remain correct.

Verification

Original privilege-escalation regression reproduced; real production tool construction exposes no privileged tools to forged callers while genuine authenticated owners retain access. Hundreds of owner, recovery, plugin, and Discord tests plus independent review passed.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord gateway Gateway runtime commands Command implementations agents Agent runtime and tooling plugin: file-transfer size: L maintainer Maintainer-authored PR labels Jul 12, 2026
@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 12, 2026
@clawsweeper

clawsweeper Bot commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 25, 2026, 11:05 PM ET / August 26, 2026, 03:05 UTC.

ClawSweeper review

What this changes

The PR makes public agent ingress discard caller-supplied owner status and introduces a plugin-runtime admission path for authenticated channel owners.

Regression provenance

Possible regression — probable (reviewed change; reproduction). No predecessor PR is attributed.

Merge readiness

⛔ Blocked until real behavior proof is added - 10 items remain

Keep open. The central current-main privilege escalation is source-proven, but the new trusted-runtime path has a lifecycle race that can retain owner authority after plugin rollback; it also needs authority-specific real-behavior proof before merge.

Priority: P0
Reviewed head: 52ff4729339e5a83d7c11c616bdfec3e4ef138be
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The public-ingress repair is source-backed, but a blocking authority-lifecycle race and missing final-effect proof prevent a merge-ready rating.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: Authority-chain proof required: the PR body asserts a successful run, but no inspectable current-head trace shows that a forged caller is denied before owner-tool construction, that rollback during dispatch also denies it, and that a genuine authenticated owner remains authorized. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: Authority-chain proof required: the PR body asserts a successful run, but no inspectable current-head trace shows that a forged caller is denied before owner-tool construction, that rollback during dispatch also denies it, and that a genuine authenticated owner remains authorized. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 9 items Current-main flaw: Current main spreads public ingress options without overwriting sender ownership, so a public caller can carry senderIsOwner into the gateway ingress path.
Head sanitizer: The PR head fixes the public entry point by forcing senderIsOwner to false.
Original behavior provenance: Blame attributes the current-main sanitizer that omitted the ownership reset to the earlier agent-runtime work, establishing the affected owner boundary and history.
Findings 1 actionable finding [P1] Revalidate channel owner authority after lazy dispatch
Security Needs attention Retained owner admission survives an async rollback window: The new registry check precedes an awaited lazy dispatch and is not revalidated before privileged tool construction, so authority can outlive the active plugin lifecycle.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

$ node scripts/run-node.mjs --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 105.77 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.8s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 14.7s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4410ms (slowest: built plugin control-plane loads 3642ms)

OpenClaw 2026.8.1 (52ff472) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console (silent|fatal|error|warn|info|debug|trace)
  --no-color           Disable ANSI colors
  --profile ‹name›     Use a named profile (iso
… output truncated …

Assertions:

  • PASS expect_output: Usage:

How this fits together

Channel plugins turn inbound messages into agent runs, where sender ownership controls access to owner-only tools. The change places the ownership decision between the plugin runtime and agent command execution.

flowchart LR
A[Inbound channel message] --> B[Channel plugin]
B --> C[Plugin runtime admission]
C --> D[Owner authority check]
D --> E[Agent tool construction]
E --> F[Agent response]
Loading

Decision needed

Question Recommendation
Should the Plugin SDK expose this trusted channel-owner admission capability once it is closure-bound through final owner-tool construction, with public callers permanently unable to assert ownership? Require closure-bound admission: Repair the rollback race, add final-effect regression proof, and retain the public-ingress ownership reset.

Why: This changes a public plugin authority boundary and deliberately changes prior owner-claim behavior; repository policy requires security-owner acceptance for widened trust or authority.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: Authority-chain proof required: the PR body asserts a successful run, but no inspectable current-head trace shows that a forged caller is denied before owner-tool construction, that rollback during dispatch also denies it, and that a genuine authenticated owner remains authorized. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Revalidate channel owner authority after lazy dispatch (P1) - The wrapper verifies liveness before dispatch, but runCommandFromIngress awaits its lazy loader before entering the command path. A rollback in that gap leaves the retained callback able to construct an owner-authorized run; carry closure-bound liveness to the final privileged boundary and prove rollback during dispatch denies owner tools.
  • Resolve security concern: Retained owner admission survives an async rollback window - The new registry check precedes an awaited lazy dispatch and is not revalidated before privileged tool construction, so authority can outlive the active plugin lifecycle.
  • Resolve merge risk (P1) - A plugin can be rolled back after the registry check but before lazy dispatch reaches tool construction, leaving a retained callback able to begin an owner-authorized run.
  • Resolve merge risk (P1) - The new runtime admission capability and the changed semantics of the public owner claim are compatibility-sensitive SDK behavior that need explicit security-owner acceptance.
  • Complete next step (P2) - A security and SDK owner must choose the final authority contract and review the closure-bound repair; the protected maintainer label and P1 lifecycle defect rule out autonomous repair routing.
  • Improve patch quality - Carry closure-bound plugin liveness through lazy dispatch and revalidate before owner-only tool construction.
  • Improve patch quality - Add a deterministic rollback-during-dispatch regression proving no owner tools or effects occur.
  • Improve patch quality - Attach redacted current-head final-effect evidence for forged, revoked, and genuine-owner paths.

Findings

  • [P1] Revalidate channel owner authority after lazy dispatch — src/plugins/registry-runtime.ts:1000-1002
  • [high] Retained owner admission survives an async rollback window — src/plugins/registry-runtime.ts:1000
Agent review details

Security

Needs attention: A concrete retained-authority race can let a revoked plugin callback cross the new owner-admission boundary after rollback.

PR surface

Source +75, Tests +116, Docs +6, Other -1. Total +196 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 8 80 5 +75
Tests 5 119 3 +116
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 15 205 9 +196

Review metrics

Metric Value Why it matters
Production versus test delta production +78/-6, tests/test support +121/-3, docs +6 The security repair adds 72 net production lines for runtime admission; that growth is warranted only if the final lifecycle revalidation closes the retained-authority gap.
Plugin authority surface 1 added runtime method, 1 deprecated public owner claim The PR changes how channel plugins may preserve owner status, making SDK compatibility and authority ownership material before merge.

Merge-risk options

Maintainer options:

  1. Bind authority through rollback (recommended)
    Pass closure-bound liveness to the final owner-tool boundary and add a regression that revokes the plugin while lazy dispatch is pending.
  2. Pause the authority API
    Do not merge the new plugin runtime owner-admission path until a security owner accepts its public SDK contract and lifecycle model.

Technical review

Best possible solution:

Carry a non-forgeable, closure-bound liveness assertion through lazy command dispatch, revalidate it immediately before owner-only tool binding or effects, and prove both rollback denial and authenticated-owner preservation.

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

Yes, source provides a high-confidence harness path: retain a trusted plugin admission callback, begin lazy dispatch, revoke the plugin before its loader resolves, then assert that no owner-only tools are constructed.

Is this the best way to solve the issue?

No. Resetting public ownership is the right direction, but the proposed admission restores owner authority after an await without a final liveness check; authority must remain closure-bound through the privileged boundary.

Full review comments:

  • [P1] Revalidate channel owner authority after lazy dispatch — src/plugins/registry-runtime.ts:1000-1002
    The wrapper verifies liveness before dispatch, but runCommandFromIngress awaits its lazy loader before entering the command path. A rollback in that gap leaves the retained callback able to construct an owner-authorized run; carry closure-bound liveness to the final privileged boundary and prove rollback during dispatch denies owner tools.
    Confidence: 0.95

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b5fcae34fe13.

Labels

Label justifications:

  • P0: The underlying current-main path allows a public plugin caller to claim owner status and reach owner-only tools.
  • merge-risk: 🚨 compatibility: Existing public plugin callers that supplied senderIsOwner now lose that behavior and must use the new runtime admission path.
  • merge-risk: 🚨 security-boundary: The PR changes the authorization path that determines whether agent runs receive owner-only tools.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Authority-chain proof required: the PR body asserts a successful run, but no inspectable current-head trace shows that a forged caller is denied before owner-tool construction, that rollback during dispatch also denies it, and that a genuine authenticated owner remains authorized. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [high] Retained owner admission survives an async rollback window — src/plugins/registry-runtime.ts:1000
    The new registry check precedes an awaited lazy dispatch and is not revalidated before privileged tool construction, so authority can outlive the active plugin lifecycle.
    Confidence: 0.95

What I checked:

Likely related people:

  • steipete: Git blame ties the original public ingress sanitizer to this area, and the PR head authority implementation is authored by the same contributor. (role: introduced affected behavior and current repair; confidence: high; commits: 6133ad92a062, 52ff4729339e; files: src/agents/agent-command-execution-identity.ts, src/plugins/registry-runtime.ts, src/plugins/runtime/runtime-agent.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 (7 earlier review cycles)
  • reviewed 2026-07-12T01:59:00.690Z sha 43c6ac6 :: needs real behavior proof before merge. :: [P1] Derive owner authority from host-verified sender identity
  • reviewed 2026-07-31T03:52:03.744Z sha 43c6ac6 :: needs real behavior proof before merge. :: [P1] Derive owner authority from verified sender identity
  • reviewed 2026-07-31T09:39:44.542Z sha 43c6ac6 :: needs real behavior proof before merge. :: [P1] Derive owner authority from verified sender identity
  • reviewed 2026-08-10T17:05:11.249Z sha 74e2b96 :: found issues before merge. :: [P1] Preserve verified Discord voice owner authority
  • reviewed 2026-08-10T19:02:32.989Z sha 5448bc168b4d14ed034ea61ec6dd74a35f94247a :: needs maintainer review before merge. :: none
  • reviewed 2026-08-10T21:00:14.236Z sha ec4a65a :: needs maintainer review before merge. :: none
  • reviewed 2026-08-25T22:37:29.314Z sha 8908bfb :: needs real behavior proof before merge. :: none

@steipete steipete self-assigned this Aug 10, 2026
@steipete
steipete force-pushed the codex/conversation-identity-ingress branch from 43c6ac6 to 74e2b96 Compare August 10, 2026 15:21
@steipete steipete changed the title feat(agents): guard raw ingress by conversation audience fix(agents): move ingress owner authority into host admission Aug 10, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The branch has been rewritten from current main around the existing execution-identity admission. Public Plugin SDK ingress can no longer author owner authority; authenticated hosts mint a token-bearing admission, all internal/bundled callers are migrated, the public SDK baseline was regenerated by its owner script, and Codex MCP arguments remain authority-free. Focused tests and Codex autoreview are clean on head 74e2b96868d32158ec58325ce3b0d9fb67d6cc7f.

Landing is intentionally stopped: the changed-file gate reproduces a current-main environment-ratchet failure (503/507) unrelated to this patch. No baseline workaround or prepare/merge was attempted.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 10, 2026
@steipete
steipete force-pushed the codex/conversation-identity-ingress branch from 74e2b96 to 5448bc1 Compare August 10, 2026 18:52
@steipete
steipete marked this pull request as ready for review August 10, 2026 18:54
@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Head 5448bc168b4d14ed034ea61ec6dd74a35f94247a is rebased on current main and ready for review. Public ingress can no longer author owner authority; current-main Gateway callers now mint token-bearing admissions at the authenticated routing boundary, the stale unbound/redirected audience move is explicitly dispositioned in the PR body, the Plugin SDK artifact was regenerated by its owner script, the changed gate is green on run 31419758726, and final Codex autoreview is clean.

@steipete
steipete force-pushed the codex/conversation-identity-ingress branch 2 times, most recently from 2f19d29 to ec4a65a Compare August 10, 2026 20:17
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. and removed P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 10, 2026
@steipete
steipete force-pushed the codex/conversation-identity-ingress branch from ec4a65a to 8e2b3c1 Compare August 25, 2026 21:31
@steipete steipete changed the title fix(agents): move ingress owner authority into host admission fix(agents): reject forged plugin owner authority Aug 25, 2026
@steipete
steipete force-pushed the codex/conversation-identity-ingress branch from 8e2b3c1 to 8908bfb Compare August 25, 2026 22:31
@clawsweeper clawsweeper Bot added 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 rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 25, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready exact head 52ff472: Untrusted public plugin ingress could claim owner privileges, while overly broad hardening could accidentally reject legitimate community guest ingress. Mint and validate trusted owner provenance only for actual claimed owner access; read canonical host-owned owner and channel facts exactly once. Forged public ingress exposes no owner-only tools; authenticated active-channel owners retain them; legitimate third-party guest ingress continues working. 277 cross-surface owner/guest/inactive-channel tests, clean fresh P1 review, exact CI, and direct upstream Codex protocol-source inspection all pass. Sanitized live proof: forged public ingress senderIsOwner=true resolves effectiveSenderIsOwner=false with no owner tools; authenticated active-channel owner resolves effectiveSenderIsOwner=true and retains nodes, mobile_ui, computer, automations, sessions, terminal, portal, gateway and conversations. MCP arguments do not establish host authority: personally checked codex-rs/core/src/tools/handlers/mcp.rs:174-192, codex-rs/core/src/mcp_tool_call.rs:110-140 and codex-rs/codex-mcp/src/binding.rs:251-282. Maintainer is an active security-operations team member.

@steipete
steipete merged commit 20b453f into main Aug 26, 2026
200 checks passed
@steipete
steipete deleted the codex/conversation-identity-ingress branch August 26, 2026 03:36
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: discord Channel integration: discord commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. plugin: file-transfer rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts 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.

1 participant