Problem
CLI messages-mode file reads lack full parity with markdown mode:
Messages mode is missing the O_NOFOLLOW defense-in-depth protection.
Root Cause
The symlink guard is baked into the resolver's file-open layer. Messages mode calls std::fs::read() directly, bypassing that protection.
Suggested Fix
Add compile_messages_file() and compile_messages_file_with_deps() entry points to mds-core that route through the resolver, giving messages-mode input both:
- Size cap enforcement (
MAX_FILE_SIZE)
- Symlink protection (
O_NOFOLLOW)
Then switch CLI messages-mode to use the new resolver-backed paths.
Acceptance Criteria
Notes
This is an API addition to mds-core, out of scope for the contained CLI fix made in PR #87. Deferred as a separate feature.
Related: PR #87 (commit 532ac03 — MAX_FILE_SIZE enforcement), sub-issue of I11 (symlink parity)
Problem
CLI messages-mode file reads lack full parity with markdown mode:
read_build_input): reads the entry file through the resolver'sNativeFs::read, which opens withO_NOFOLLOW(symlink protection)read_build_input): enforcesMAX_FILE_SIZE(fixed in PR feat: structured JSON output via @message blocks and compileMessages() (#56) #87) but still reads viastd::fs::read, which follows symlinksMessages mode is missing the
O_NOFOLLOWdefense-in-depth protection.Root Cause
The symlink guard is baked into the resolver's file-open layer. Messages mode calls
std::fs::read()directly, bypassing that protection.Suggested Fix
Add
compile_messages_file()andcompile_messages_file_with_deps()entry points tomds-corethat route through the resolver, giving messages-mode input both:MAX_FILE_SIZE)O_NOFOLLOW)Then switch CLI messages-mode to use the new resolver-backed paths.
Acceptance Criteria
compile_messages_file*functions added to mds-core public API--format messages input-symlink.mdsfails)cargo clippy— 0 warningsNotes
This is an API addition to mds-core, out of scope for the contained CLI fix made in PR #87. Deferred as a separate feature.
Related: PR #87 (commit 532ac03 — MAX_FILE_SIZE enforcement), sub-issue of I11 (symlink parity)