Skip to content

tech-debt: Add resolver-backed compile_messages_file for CLI messages-mode symlink parity #89

@dean0x

Description

@dean0x

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

  • New compile_messages_file* functions added to mds-core public API
  • CLI messages-mode switches to resolver-backed path
  • CLI integration tests verify symlink rejection (e.g., --format messages input-symlink.mds fails)
  • All existing tests pass
  • cargo clippy — 0 warnings

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions