Repository navigation
fix(file-transfer): keep remembered approvals exact - #129762
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 3:48 AM ET / 07:48 UTC. ClawSweeper reviewWhat this changesThis PR replaces remembered file-transfer approvals with exact node, command, requested-path, and canonical-path grants; adds a legacy-permission migration command; and binds final file operations to filesystem identity. Merge readinessKeep open for maintainer review. Current main still persists “allow always” paths in operator glob arrays, while this PR moves them to exact grants and binds final node I/O to preflight identity; no new discrete correctness defect was found in the reviewed paths, but the intentional fail-closed upgrade behavior needs an explicit maintainer decision. Priority: P1 Review scores
Verification
How this fits togetherThe bundled file-transfer plugin authorizes Gateway requests before dispatching paired-node file reads, writes, listings, and archives. The policy layer supplies a verified canonical target and identity binding to the node handler immediately before filesystem I/O. flowchart LR
A[Gateway file request] --> B[File-transfer policy]
B --> C[Node preflight]
C --> D[Exact approval and binding]
D --> E[Final node filesystem operation]
E --> F[Gateway result and audit]
Decision needed
Why: This is a deliberate compatibility and operator-recovery tradeoff: it prevents ambiguous durable authority from remaining active, but changes existing configured behavior on upgrade. Before merge
Agent review detailsSecurityNone. PR surfaceSource +1385, Tests +1594, Docs +33, Generated 0, Other -1. Total +3011 across 40 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the plugin-owned exact-grant and final-I/O binding design, but land only after a maintainer explicitly accepts the fail-closed legacy migration and exact-head CI is green. Do we have a high-confidence way to reproduce the issue? Yes, in source: current main persists allow-always paths into glob arrays, while the PR’s focused tests and exact-head transport proof exercise the narrower grant and final-I/O binding path. Is this the best way to solve the issue? Yes, subject to the maintainer’s upgrade decision: separating authored glob policy from plugin-owned exact grants and revalidating at the final node effect is the clean owner-boundary repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 29b1664aed86. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
cd752b1 to
66621d8
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
a203f32 to
8ec2de7
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
* fix(file-transfer): bind standing approvals exactly * fix(file-transfer): keep validator error lint-safe * fix(file-transfer): bind directory listing target before I/O * fix(file-transfer): keep dir list preflight type stable * test(file-transfer): split directory listing policy coverage * fix(file-transfer): bind final node effects * fix(file-transfer): close migration and archive gaps * fix(file-transfer): bind standing grants before preflight * fix(file-transfer): bind directory listings to checked target * fix(file-transfer): bind final effects to filesystem identity * test(file-transfer): prove exact approval transport * fix(file-transfer): keep reapproval prompts path-scoped * chore(config): refresh generated baselines
What Problem This Solves
Fixes an issue where remembered file-transfer approvals did not stay bound to the exact node, operation, requested path, and resolved path that the operator approved.
Why This Change Was Made
Remembered approvals now use a plugin-owned, versioned exact-grant format keyed by stable node ID and command, with literal requested and canonical paths. They are evaluated separately from operator-authored wildcard policy, remain subordinate to hard denies and
ask: always, and are persisted only after the operation completes with the validated canonical target.Older positive rules have no reliable provenance, so the runtime leaves them inactive until the operator classifies them.
openclaw doctorgives a direct handoff to:The migration offers three explicit choices for every older positive rule, including wildcard selectors: require exact reapproval, keep it as an intentional wildcard, or remove it. An exact-reapproval choice makes only that selected path askable and preserves the node's existing
askmode for every unrelated miss. It performs one atomic config mutation, reports the verified adjacent backup for the file that actually owns the plugin config (including$include), and warns that older OpenClaw versions require restoring that backup before downgrade.Alternatives considered:
nodeswas rejected because node-ID precedence would shadow the operator's display-name or wildcard policy, including denies, limits, and symlink behavior.User Impact
New “always allow” choices apply only to the exact approved node, operation, and canonical path. Existing deny rules, transfer limits, symlink policy, and authored wildcards continue to compose normally.
Operators with older positive file-transfer permissions receive a clear Doctor message and run one command to review them. Exact approvals prompt once on next use; they do not turn unrelated denied paths into prompts. Intentional wildcards can be preserved explicitly. Until review finishes, ambiguous older positive permissions fail closed instead of silently carrying forward.
Downgrading after migration requires restoring the adjacent pre-migration config backup before starting the older binary; the command shows this warning before it writes.
Evidence
Clean Linux proof on exact head
8ec2de7c26fd97bbc208c02acb60d2215d3c7c09:tbx_01m0zc4h9n2dpfh6y5v7yw498k: https://github.com/openclaw/openclaw/actions/runs/32986155244CANONICAL_PATH_CHANGEDbefore any replacement bytes were read.Redacted exact-head terminal trace:
The complete plugin suite also passed locally: 26 files, 243 passed and 2 skipped (245 total). All branch-owned
pnpm check:changedlanes passed, including Doctor closure and plugin-boundary checks.{ "status": "needs-input", "changed": false, "command": "openclaw file-transfer approvals migrate", "item": { "selector": "Shared", "kind": "read", "path": "/tmp/report-*.txt" } }Authority-chain regression coverage verifies both sides of the boundary:
@openclaw/fs-saferoot and pinned-operation implementation;tarsubprocess: the child changes into the target directory, verifiesrealpath(".")against the approved canonical target, and only then launchestarwith the bound working directory, so renaming or replacing the original path cannot retarget archive bytes;cwdand compare its identity before listing or spawningtar, existing-file writes compare the writable handle before truncation, and new-file writes use a root pinned to the preflight parent identity;cwdis bound stays on the approved directory, while renaming and recreating the same canonical pathname before binding exits before listing or archive creation;dir.fetchproof covers both outcomes: an unchanged remembered target performs the real preflight and final archive and returns bytes; a retargeted symlink reaches a new approval decision after one node call whose parameters carry the stored canonical target, so the real node handler rejects it before its enumeration andtarbranches;dir.fetchgrants cover only the validated descendants of that exact directory operation;ask: off: their next use can prompt, unrelated misses remain denied, and the pending marker is removed only when the complete exact grant is saved.Additional validation:
pnpm config:docs:checkpnpm plugins:inventory:checkpnpm format:docs:checkpnpm docs:check-mdxgit diff --checkpnpm tsgo:extensions:testpnpm check:changed.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --stream-engine-output: clean, no accepted/actionable findings; patch judged correct with 0.96 confidence.Review Metrics and Risk
The production growth implements the new exact-grant owner boundary, canonical validation flow, and the approved migration/Doctor UX; it does not add a compatibility shim, protocol path, or persistent store. The final refactor splits approval, parameter, and preflight ownership out of the previous oversized policy module and removes its max-lines exception. The main compatibility risk is intentional: ambiguous legacy positive permissions remain inactive until the one-command review, and older binaries cannot read the migrated config without restoring the backup.
Windows drive and UNC strings are covered as opaque exact-match cases. No platform path normalization was added on the Gateway; canonicalization remains owned by the target node filesystem.