Repository navigation
fix(root): classify path traversal permission failures - #1044
Conversation
|
🦞👀 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. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: blocked before merge. What this changesThis PR classifies raw Root traversal permission failures as operational permission-denied errors while retaining their cause and affected path. Example: Root.mkdir("blocked/child") encounters EACCES while inspecting /workspace/blocked/child.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open: it addresses a real error-classification defect still present on main, but its new diagnostic bypasses existing pathname escaping. Priority: P2 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherRoot operations pass untrusted paths through shared confinement and identity checks; resolution wrappers translate rejected filesystem operations into public FsSafeError diagnostics. flowchart TD
A[Caller pathname] --> B[Root operation]
B --> C[Confinement and identity checks]
C --> D[Filesystem traversal]
D --> E[Resolution error wrapper]
E --> F[FsSafeError returned to caller]
Technical reviewBest possible solution: Retain the shared classification repair and escape denied pathnames with formatErrorDetail before constructing the public diagnostic. Do we have a high-confidence way to reproduce the issue? Current-main wrappers and the supplied non-root failure trace establish the classification defect; this read-only review ran no target code or tests. Is this the best way to solve the issue? The existing wrappers and shared error owner are the smallest appropriate repair boundary, provided the new pathname text preserves the established escaping contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f4af1002a2a0. Provenance checked
TestingProof path: unit tests only. SecurityNeeds attention: Filesystem rejection remains fail-closed, but the new diagnostic reintroduces attacker-controlled control characters into display text. EvidenceSecurity concerns:
What I checked:
Likely related people:
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 October 27, 2026, 3:57 PM ET / 19:57 UTC. |
2b2e61b to
c76c747
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c76c747eda
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (error instanceof FsSafeError) return error.code === "permission-denied" ? error : undefined; | ||
| if (!hasNodeErrorCode(error, "EACCES") && !hasNodeErrorCode(error, "EPERM")) return; | ||
| const deniedPath = isNodeError(error) && typeof error.path === "string" ? error.path : targetPath; | ||
| return new FsSafeError("permission-denied", `permission denied while resolving ${deniedPath}`, errorCauseOptions(error)); |
There was a problem hiding this comment.
Escape the denied path before embedding it in the diagnostic
On POSIX, a denied path can contain newlines or terminal escape characters. Interpolating error.path (or the fallback path) directly into this message lets attacker-controlled names inject log lines or terminal formatting, violating the diagnostic escaping contract documented in docs/errors.md. sanitizeRootPathError() only sanitizes the original error's message, not its path property or this newly constructed message. Apply the shared formatErrorDetail() helper before interpolation and add a regression case containing control characters. This also follows the instruction in AGENTS.md to treat pathnames as attacker-controlled.
AGENTS.md reference: AGENTS.md:L30-L31
Useful? React with 👍 / 👎.
Root path resolution currently labels an operating-system traversal denial as
path-alias, even when no alias or confinement violation occurred. This causes misleading sandbox startup errors in openclaw/openclaw#184115.Classify raw
EACCES/EPERMfailures at the existing Root resolution wrappers as additive operationalpermission-denied, retaining the original errno as the cause and the affected path in the message. The operation still fails closed; established policy errors and the default directory permissions keep their existing behavior. Thanks @LiuwqGit for the reproduction.Evidence: all six mkdir/resolve/write regression cases fail against the base with
path-aliasand pass with the repair. Focused Root/error tests pass (71 tests); package build, generated public API snapshot, and installed-package checks pass. Fullpnpm checkpasses: 14,361 tests pass across 761 test files (91 platform-gated files skipped), followed by installed-package declaration/runtime validation. Two existing tests that expected the former path-alias classification were updated; their focused rerun and separate independent review are clean. Independent autoreview at P0–P2 is scoped-clean. Error-code documentation and the Unreleased changelog are updated.