MCP server: allow absolute attachment paths via operator-configured roots - #952
MCP server: allow absolute attachment paths via operator-configured roots#952chesterXalan wants to merge 1 commit into
Conversation
- MM_MCP_ATTACHMENT_ROOTS (OS path-list of directories) lets local-mode attachments use absolute paths; each root is opened through os.Root so symlinks and path traversal cannot escape the allowed directory - relative paths still resolve inside the data directory; absolute paths are rejected when no roots are configured
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe file utilities now support absolute local attachment paths through configured ChangesLocal attachment root support
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: Sequence Diagram(s)sequenceDiagram
participant FetchFileDataForLocal
participant readLocalFileFromAllowedRoots
participant os.Root
participant Filesystem
FetchFileDataForLocal->>readLocalFileFromAllowedRoots: absolute attachment path
readLocalFileFromAllowedRoots->>os.Root: open configured root
os.Root->>Filesystem: read validated file
Filesystem-->>readLocalFileFromAllowedRoots: file data
readLocalFileFromAllowedRoots-->>FetchFileDataForLocal: size-limited data or error
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Split from #888 to keep reviews small and focused. This part adds operator-configured roots for absolute attachment paths in local access mode:
MM_MCP_ATTACHMENT_ROOTS(OS path-list of directories, e.g./srv/exports:/var/reports) allows local-mode attachments to reference absolute paths. Each root is opened throughos.Root, so symlinks and path traversal cannot escape an allowed directory.QA test steps:
MM_MCP_ATTACHMENT_ROOTS.MM_MCP_ATTACHMENT_ROOTS=/tmp/exports, attach/tmp/exports/report.pdf→ the file uploads. Attach a symlink under/tmp/exportspointing outside it → rejected.Ticket Link
None. Supersedes part of #888.
Release Note
Summary by CodeRabbit
New Features
Bug Fixes