Repository navigation
test(lint): fail turn-kind reads and owner production outside admission - #204823
Conversation
Adds openclaw-boundaries/no-turn-authority-derivation. It fails turn-kind flag reads, senderIsOwner/requesterOwner values that are not a pass-through or grant.owner, and provenance reads in capability modules, outside allowlists that equal today's readers. The boundary-guards test pins a ceiling per list (and for ADMISSION_FILES) and fails any entry that no longer trips its check. Co-authored-by: obviyus <[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. |
`{ senderIsOwner = true } = input` produced owner status without a diagnostic.
AssignmentPattern defaults for senderIsOwner/requesterOwner now go through the
same pass-through check; the fixture covers a producing default and a plain
destructured pass-through. Allowlists on main are unchanged.
Co-authored-by: obviyus <[email protected]>
`{ isAdmin: requesterOwner = true } = input` named the owner field only in the
destination binding; the default check now matches the source property or the
destination binding.
Co-authored-by: obviyus <[email protected]>
|
Codex review: needs changes before merge. What this changesThis PR adds lint checks and shrinking allowlist tests for turn-kind reads, owner-status production, and capability provenance reads. Example: A contributor adds
Review scores
ProductKind: Maintenance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: this maintainer-authored PR adds useful admission-boundary enforcement, but two ordinary TypeScript forms bypass its new checks. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherThe focused Oxlint boundary lane parses repository source and applies registered rules, producing diagnostics that gate contributor changes without changing Gateway runtime behavior. flowchart LR
A[Repository source] --> B[Focused Oxlint runner]
B --> C[Boundary plugin]
C --> D[Authority derivation rule]
D --> E[Allowlist exceptions]
D --> F[Lint diagnostics]
Technical reviewBest possible solution: Extend the existing rule and fixture to reject aliased owner bindings and static string-literal reads while preserving documented pass-throughs. Do we have a high-confidence way to reproduce the issue? Source inspection establishes both visitor gaps with concrete inputs; no target code or tests were executed under the read-only review constraint. Is this the best way to solve the issue? The existing boundary plugin is the appropriate owner, and focused syntax coverage repairs complete the proposed guard without another runtime authority layer. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 986ad151d123. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceTests +99, Other +285. Total +384 across 6 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 24, 2026, 1:27 PM ET / 18:27 UTC. |
|
Landed as 3358612. Tooling only: |
…204756) ## Problem The same person got a different answer depending on how the turn started: - A Control UI steer from a native app, or one sent with system provenance, could not replace a pending question. - An `operator.admin` client outside `commands.allowFrom` was refused slash commands (#198259). - Skill authoring read `isHumanTurn` on chat.send and a list of internal start kinds on the agent RPC. Same-person internal turns got the false refusal "Skill authoring needs a fresh message". - Workspace skill authoring re-read the live role in the middle of a turn. ## Fix This is OA2 PR 1b. It builds on the lint guard from #204823. Admission now decides what a turn may do, and the Control UI entry kinds read that decision. - **`TurnGrant`** (`owner`, `skillAuthoring`, `questionReplace`, `commands`) is a frozen field on `AdmittedRunOperatorAuthority`. Only `decideTurnGrant(scopes)` in `src/gateway/operator-admission.ts` produces it. - Every authority constructor calls it: replay `decide`, fresh Gateway admission, channel capture and continuation narrowing. - It is in memory only, so no schema changes. A replay admits again from its recorded source. - **Owner tools** (`dangerous-tools.ts`) and the **transcript owner stamp** (`chat-user-turn-recorder.ts`) read `grant.owner`, which is `operator.admin` in the admitted scopes. - **Commands:** chat.send puts the grant on the command context as `TurnGrant`. - `grant.commands === "all"` (`operator.admin`) passes `commands.allowFrom`, per Ayaan's decision. Non-admins keep the list and its visible refusal. - `TurnGrant` is trusted only on the internal provider, like `GatewayClientScopes`. - Docs are updated (`tools/slash-commands`, `gateway/config-channels/commands`). - **Skill authoring:** deleted `isHumanTurn`, `canPrepareSkillAuthoring` and the agent RPC internal-start list. `grant.skillAuthoring` decides. - The client checks stay: in-process runtime callers carry no attributed person. - Workspace authoring reads `grant.owner` instead of re-reading the role mid-turn. - Also deleted the mid-preparation "requester changed" scope re-check. - `skill-library-authoring.ts` leaves `ADMISSION_FILES`. - **Question replacement:** deleted the Control UI client-id, `turnKind`, provenance and internal re-entry gates. `grant.questionReplace` plus the request shape (steer, non-command, pending question) decide. - **Lint allowlists shrink:** - `ADMISSION_FILES` 63 → 62; - turn-kind flags 24 → 21 (`chat-send-input-dispatch`, `chat-send-agent-dispatch.types`, `skill-library-authoring`); - owner producers 53 → 52 (`chat-user-turn-recorder`); - capability provenance 5 → 4 (`chat-send-question-replacement`). - **Matrix:** the admission table's real-Gateway `after-start` rows now also check the grant at fresh admission and at saved-source replay. Cells: Control UI token, password, OpenClaw ID owner, Tailscale, Tailscale device and trusted proxy; CLI via Gateway; Discord linked identity. - `KNOWN_DIVERGENT` is shrink-only, with a ceiling. Its one entry: a linked Discord sender gets its role's scopes while the same person over Tailscale gets `identityScopes`. PR 2 fixes it. ## Decisions (recorded, not asked) - **Owner:** `grant.owner` is `operator.admin` in the admitted scopes. Saved channel and parent-bound command ownership stays in `requesterOwner`, read only by scheduled occurrences, until PR 2 (verified configured channel owner) and PR 4 (parent-bound sources). The round-2 review of the earlier head found that putting that fact in the grant would give owner-only tools to a read/write channel command owner. - **Internal starts:** same-person internal starts (agent RPC internal events, approval follow-ups, re-entries with handler options) now get the grant their admission produced. The skill tool shape is already stable per session, so the provider request does not change. The client checks still exclude in-process runtime callers. - **Read-only steer:** a read-only client no longer replaces a pending question (`questionReplace` needs `operator.sessions.write`). - **Narrowing:** a continuation that narrows scopes re-derives its grant from the narrowed scopes. - **Deferred:** `grant.automations` (the cron-creator classifier) and moving the fresh-turn decision out of `operator-run-authority.ts` go in a later PR. `prActions` comes with PR 3. ## User impact - An admin on Control UI or WebChat can run slash commands even when `commands.allowFrom` does not list it. - A steer from any client with session write (native app, system-provenance turn, reconnect) can replace an ordinary pending question. - Same-person internal turns no longer get the false "Skill authoring needs a fresh message" refusal. - Owner tools, the transcript owner stamp and workspace skill authoring follow one admission decision. ## Evidence - **Production lines:** `src` (non-test) +109 / −110. - **Red on base `23e252373e9b`** (head tests run against base code): question replacement from a native app, a system-input turn, and the read-only case; `/status` for an admitted admin outside `commands.allowFrom`. All four fail on base and pass on head. - **Matrix:** on the earlier head, all 8 cells passed and the one `KNOWN_DIVERGENT` cell still diverged. The admission table also passed. - **E2E `one-admission-e2e/run.sh`:** Q, R and S all pass. Q: queued input refused visibly. R: a running turn finishes. S: Stop cancels. - **Z5 reconnect skill case:** turns A, B and C each list `skill_library`. - **Z1 #167867 case:** turns A, B and C each see `scope=gateway total=3`. - **Failing on base too (not ours):** `subagent-registry.requester-wake.e2e` (6 receipt cases time out) and `reef-shutdown.gateway`. Co-authored-by: Ayaan Zaidi <[email protected]>
…on (openclaw#204823) ## Problem Every bug this week was the same person getting a different answer depending on how the turn started: a reconnect resume, an internal client, provenance, or a second owner decider. Nothing stops new code from adding another turn-kind branch or another `senderIsOwner` producer outside admission. ## Fix This is tooling only (OA2 PR 1a). It changes no runtime code. - New lint rule `openclaw-boundaries/no-turn-authority-derivation` (`scripts/lib/no-turn-authority-derivation.mjs`), registered in `config/oxlint/boundary-guards.json`. It fails three things outside their allowlists: 1. **Turn-kind flag reads:** `reconnectResumeRequested`, `isLinkedOwnerDevice`, `isAuthenticatedOwner`, `recordedOperatorAuthority`, `senderIsOwnerByScope`, `isHumanTurn`, `canPrepareSkillAuthoring`, `prepareCommandOwnerAuthority` or `isConfiguredCommandOwner`, read outside `TURN_FLAG_FILES`. 2. **Owner production:** a `senderIsOwner`/`requesterOwner` property, assignment or declaration whose value is not a pass-through of the same name, `….grant.owner`, `false` or `undefined`, outside `OWNER_PRODUCER_FILES`. 3. **Capability modules that read how the turn started:** `systemInputProvenance`, `inputProvenance`, `turnKind`, `trigger`, `syntheticClient` or `clientInfo`, read in a capability module (skill authoring, question replacement, cron creator admission, session event context, turn authority, dangerous tools, automations scope, `github-publication-*`) outside `CAPABILITY_PROVENANCE_FILES`. - The allowlists equal today's readers on `main` (24, 53 and 5 files). - `no-operator-permission-read` exports `ADMISSION_FILES` (63) and accepts the same `ignoreAllowlists` option. The stale-entry test needs that option to re-run the rule with the allowlists off. - `test/scripts/oxlint-boundary-guards.test.ts`: - pins a ceiling for each of the four lists; - re-runs both rules with `ignoreAllowlists: true` over every listed file, and fails any entry that no longer trips its check. A list can only shrink, and it must shrink as code moves. - A planted-divergence fixture (`turn-authority-derivation-violation.ts`) must report 5 findings: two turn-kind reads, two owner values produced by destructuring defaults (one through the source property, one through an aliased destination binding), and one owner value produced from scopes. Pass-throughs report nothing. ## User impact None at runtime. Contributors get a lint error when they add a turn-kind branch or an owner producer outside admission. ## Evidence - `node scripts/run-oxlint.mjs --openclaw-focused-config --config config/oxlint/boundary-guards.json src extensions packages` reports 0 findings. - `ocx test test/scripts/oxlint-boundary-guards.test.ts`: 35 passed. That includes the ceilings, the stale-entry check over all four lists, and the fixture. - oxlint on the changed files reports 0 findings. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#204756) ## Problem The same person got a different answer depending on how the turn started: - A Control UI steer from a native app, or one sent with system provenance, could not replace a pending question. - An `operator.admin` client outside `commands.allowFrom` was refused slash commands (openclaw#198259). - Skill authoring read `isHumanTurn` on chat.send and a list of internal start kinds on the agent RPC. Same-person internal turns got the false refusal "Skill authoring needs a fresh message". - Workspace skill authoring re-read the live role in the middle of a turn. ## Fix This is OA2 PR 1b. It builds on the lint guard from openclaw#204823. Admission now decides what a turn may do, and the Control UI entry kinds read that decision. - **`TurnGrant`** (`owner`, `skillAuthoring`, `questionReplace`, `commands`) is a frozen field on `AdmittedRunOperatorAuthority`. Only `decideTurnGrant(scopes)` in `src/gateway/operator-admission.ts` produces it. - Every authority constructor calls it: replay `decide`, fresh Gateway admission, channel capture and continuation narrowing. - It is in memory only, so no schema changes. A replay admits again from its recorded source. - **Owner tools** (`dangerous-tools.ts`) and the **transcript owner stamp** (`chat-user-turn-recorder.ts`) read `grant.owner`, which is `operator.admin` in the admitted scopes. - **Commands:** chat.send puts the grant on the command context as `TurnGrant`. - `grant.commands === "all"` (`operator.admin`) passes `commands.allowFrom`, per Ayaan's decision. Non-admins keep the list and its visible refusal. - `TurnGrant` is trusted only on the internal provider, like `GatewayClientScopes`. - Docs are updated (`tools/slash-commands`, `gateway/config-channels/commands`). - **Skill authoring:** deleted `isHumanTurn`, `canPrepareSkillAuthoring` and the agent RPC internal-start list. `grant.skillAuthoring` decides. - The client checks stay: in-process runtime callers carry no attributed person. - Workspace authoring reads `grant.owner` instead of re-reading the role mid-turn. - Also deleted the mid-preparation "requester changed" scope re-check. - `skill-library-authoring.ts` leaves `ADMISSION_FILES`. - **Question replacement:** deleted the Control UI client-id, `turnKind`, provenance and internal re-entry gates. `grant.questionReplace` plus the request shape (steer, non-command, pending question) decide. - **Lint allowlists shrink:** - `ADMISSION_FILES` 63 → 62; - turn-kind flags 24 → 21 (`chat-send-input-dispatch`, `chat-send-agent-dispatch.types`, `skill-library-authoring`); - owner producers 53 → 52 (`chat-user-turn-recorder`); - capability provenance 5 → 4 (`chat-send-question-replacement`). - **Matrix:** the admission table's real-Gateway `after-start` rows now also check the grant at fresh admission and at saved-source replay. Cells: Control UI token, password, OpenClaw ID owner, Tailscale, Tailscale device and trusted proxy; CLI via Gateway; Discord linked identity. - `KNOWN_DIVERGENT` is shrink-only, with a ceiling. Its one entry: a linked Discord sender gets its role's scopes while the same person over Tailscale gets `identityScopes`. PR 2 fixes it. ## Decisions (recorded, not asked) - **Owner:** `grant.owner` is `operator.admin` in the admitted scopes. Saved channel and parent-bound command ownership stays in `requesterOwner`, read only by scheduled occurrences, until PR 2 (verified configured channel owner) and PR 4 (parent-bound sources). The round-2 review of the earlier head found that putting that fact in the grant would give owner-only tools to a read/write channel command owner. - **Internal starts:** same-person internal starts (agent RPC internal events, approval follow-ups, re-entries with handler options) now get the grant their admission produced. The skill tool shape is already stable per session, so the provider request does not change. The client checks still exclude in-process runtime callers. - **Read-only steer:** a read-only client no longer replaces a pending question (`questionReplace` needs `operator.sessions.write`). - **Narrowing:** a continuation that narrows scopes re-derives its grant from the narrowed scopes. - **Deferred:** `grant.automations` (the cron-creator classifier) and moving the fresh-turn decision out of `operator-run-authority.ts` go in a later PR. `prActions` comes with PR 3. ## User impact - An admin on Control UI or WebChat can run slash commands even when `commands.allowFrom` does not list it. - A steer from any client with session write (native app, system-provenance turn, reconnect) can replace an ordinary pending question. - Same-person internal turns no longer get the false "Skill authoring needs a fresh message" refusal. - Owner tools, the transcript owner stamp and workspace skill authoring follow one admission decision. ## Evidence - **Production lines:** `src` (non-test) +109 / −110. - **Red on base `d96b6e90fee5`** (head tests run against base code): question replacement from a native app, a system-input turn, and the read-only case; `/status` for an admitted admin outside `commands.allowFrom`. All four fail on base and pass on head. - **Matrix:** on the earlier head, all 8 cells passed and the one `KNOWN_DIVERGENT` cell still diverged. The admission table also passed. - **E2E `one-admission-e2e/run.sh`:** Q, R and S all pass. Q: queued input refused visibly. R: a running turn finishes. S: Stop cancels. - **Z5 reconnect skill case:** turns A, B and C each list `skill_library`. - **Z1 openclaw#167867 case:** turns A, B and C each see `scope=gateway total=3`. - **Failing on base too (not ours):** `subagent-registry.requester-wake.e2e` (6 receipt cases time out) and `reef-shutdown.gateway`. Co-authored-by: Ayaan Zaidi <[email protected]>
…y minting (#206725) ## Problem `openclaw-boundaries/no-operator-permission-read` (#204823) blocks new live permission reads in files outside its allowlist. Since then, post-start authority re-checks landed through three paths the rule cannot see: - A started run's authority rebuilt with a separate revocation signal: `createAdmittedRunOperatorAuthority({ ...authority, signal })` in new files (`session-sharing-authorization-async.ts`, `operator-run-invocation.ts`). - `client.internal?.operatorAccessAuthority?.assertCurrent()` after a request was admitted (`question-session-access.ts`, `session-communication-approval.ts`). - New reader calls in files that were already allowlisted. The allowlist was per file, so any number of new reads passed. Each one gives one person different answers depending on timing, which the root `AGENTS.md` rule "Decide authority once" forbids. ## Change Tooling only. No runtime code changes. `scripts/lib/no-operator-permission-read.mjs`: - Every list now maps a file to its reference count today. A file in a list fails on the reference after its count, so a new read in a listed file fails too. - New check: `createAdmittedRunOperatorAuthority` outside its definition and the 7 current callers (`MINT_FILES`). - New check: `….operatorAccessAuthority.assertCurrent` outside the 2 current files (`ACCESS_RECHECK_FILES`). - Messages start with `Permission read:`, `Run authority minted:` or `Access re-check:`. `test/scripts/oxlint-boundary-guards.test.ts`: - The stale-entry test now requires each listed count to equal the references found. When a reference is removed, its count must be lowered in the same change. - New fixture `run-authority-mint-violation.ts`: 4 findings (one access re-check, three minter references). The lists start at today's callers and can only shrink. Some of those call sites are post-start re-checks that a separate change removes; that change lowers these counts. `src/gateway/AGENTS.md`: the Lint bullet names the new checks and per-file counts. ## Evidence - `test/scripts/oxlint-boundary-guards.test.ts`: 40/40 pass. The new fixture reports lines 1, 4, 8, 9, and the counts match all 58 + 7 + 2 listed files exactly. - `node scripts/run-oxlint.mjs --openclaw-focused-config --config config/oxlint/boundary-guards.json src extensions packages`: 0 errors. Co-authored-by: Ayaan Zaidi <[email protected]>
…y minting (openclaw#206725) ## Problem `openclaw-boundaries/no-operator-permission-read` (openclaw#204823) blocks new live permission reads in files outside its allowlist. Since then, post-start authority re-checks landed through three paths the rule cannot see: - A started run's authority rebuilt with a separate revocation signal: `createAdmittedRunOperatorAuthority({ ...authority, signal })` in new files (`session-sharing-authorization-async.ts`, `operator-run-invocation.ts`). - `client.internal?.operatorAccessAuthority?.assertCurrent()` after a request was admitted (`question-session-access.ts`, `session-communication-approval.ts`). - New reader calls in files that were already allowlisted. The allowlist was per file, so any number of new reads passed. Each one gives one person different answers depending on timing, which the root `AGENTS.md` rule "Decide authority once" forbids. ## Change Tooling only. No runtime code changes. `scripts/lib/no-operator-permission-read.mjs`: - Every list now maps a file to its reference count today. A file in a list fails on the reference after its count, so a new read in a listed file fails too. - New check: `createAdmittedRunOperatorAuthority` outside its definition and the 7 current callers (`MINT_FILES`). - New check: `….operatorAccessAuthority.assertCurrent` outside the 2 current files (`ACCESS_RECHECK_FILES`). - Messages start with `Permission read:`, `Run authority minted:` or `Access re-check:`. `test/scripts/oxlint-boundary-guards.test.ts`: - The stale-entry test now requires each listed count to equal the references found. When a reference is removed, its count must be lowered in the same change. - New fixture `run-authority-mint-violation.ts`: 4 findings (one access re-check, three minter references). The lists start at today's callers and can only shrink. Some of those call sites are post-start re-checks that a separate change removes; that change lowers these counts. `src/gateway/AGENTS.md`: the Lint bullet names the new checks and per-file counts. ## Evidence - `test/scripts/oxlint-boundary-guards.test.ts`: 40/40 pass. The new fixture reports lines 1, 4, 8, 9, and the counts match all 58 + 7 + 2 listed files exactly. - `node scripts/run-oxlint.mjs --openclaw-focused-config --config config/oxlint/boundary-guards.json src extensions packages`: 0 errors. Co-authored-by: Ayaan Zaidi <[email protected]>
Problem
Every bug this week was the same person getting a different answer depending on how the turn started: a reconnect resume, an internal client, provenance, or a second owner decider. Nothing stops new code from adding another turn-kind branch or another
senderIsOwnerproducer outside admission.Fix
This is tooling only (OA2 PR 1a). It changes no runtime code.
openclaw-boundaries/no-turn-authority-derivation(scripts/lib/no-turn-authority-derivation.mjs), registered inconfig/oxlint/boundary-guards.json. It fails three things outside their allowlists:reconnectResumeRequested,isLinkedOwnerDevice,isAuthenticatedOwner,recordedOperatorAuthority,senderIsOwnerByScope,isHumanTurn,canPrepareSkillAuthoring,prepareCommandOwnerAuthorityorisConfiguredCommandOwner, read outsideTURN_FLAG_FILES.senderIsOwner/requesterOwnerproperty, assignment or declaration whose value is not a pass-through of the same name,….grant.owner,falseorundefined, outsideOWNER_PRODUCER_FILES.systemInputProvenance,inputProvenance,turnKind,trigger,syntheticClientorclientInfo, read in a capability module (skill authoring, question replacement, cron creator admission, session event context, turn authority, dangerous tools, automations scope,github-publication-*) outsideCAPABILITY_PROVENANCE_FILES.main(24, 53 and 5 files).no-operator-permission-readexportsADMISSION_FILES(63) and accepts the sameignoreAllowlistsoption. The stale-entry test needs that option to re-run the rule with the allowlists off.test/scripts/oxlint-boundary-guards.test.ts:ignoreAllowlists: trueover every listed file, and fails any entry that no longer trips its check. A list can only shrink, and it must shrink as code moves.turn-authority-derivation-violation.ts) must report 5 findings: two turn-kind reads, two owner values produced by destructuring defaults (one through the source property, one through an aliased destination binding), and one owner value produced from scopes. Pass-throughs report nothing.User impact
None at runtime. Contributors get a lint error when they add a turn-kind branch or an owner producer outside admission.
Evidence
node scripts/run-oxlint.mjs --openclaw-focused-config --config config/oxlint/boundary-guards.json src extensions packagesreports 0 findings.ocx test test/scripts/oxlint-boundary-guards.test.ts: 35 passed. That includes the ceilings, the stale-entry check over all four lists, and the fixture.