You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Harden mdcode operations for untrusted Markdown and agent execution #7
Category: enhancement Summary: Enforce filesystem and shell-execution safety boundaries for untrusted Markdown.
Current behavior:
Extract and update join metadata file paths to their working paths without containment validation. Traversal can therefore escape the intended directory. Update logs failed source reads and transformer failures, then continues with stale content. Run executes a caller-provided shell command and prints global console output without a separate acknowledgement or structured CLI outcome.
Desired behavior:
Every metadata-derived file access stays below an explicit allowed base directory. Unsafe paths fail with an actionable error tied to the selected block. Source-read and transform failures stop the command by default. Shell execution remains available only through a clearly acknowledged privileged operation and produces structured per-block outcomes.
Key interfaces:
Guarded path resolution module — resolve metadata paths against an allowed base and reject absolute paths, traversal escapes, and symlink escapes. Reuse this module for all metadata-derived reads and writes.
Allowed base — update defaults to the Markdown document directory; --base explicitly selects another base for repository layouts where sources live elsewhere.
Error policy — source-read and transform failures fail the command; --continue-on-error is the only supported opt-in to collecting failures and continuing.
Privileged run operation — require --allow-shell in addition to the caller-supplied command. Markdown metadata must never supply a command to execute.
Verification status:
Confirmed by code inspection: extract and update use unchecked path joining, while update and transforms log errors and continue. This issue is blocked by #5 for the structured result contract.
Activity
adrianbrowning commentedon Aug 8, 2026
Agent Brief
Category: enhancement
Summary: Enforce filesystem and shell-execution safety boundaries for untrusted Markdown.
Current behavior:
Extract and update join metadata file paths to their working paths without containment validation. Traversal can therefore escape the intended directory. Update logs failed source reads and transformer failures, then continues with stale content. Run executes a caller-provided shell command and prints global console output without a separate acknowledgement or structured CLI outcome.
Desired behavior:
Every metadata-derived file access stays below an explicit allowed base directory. Unsafe paths fail with an actionable error tied to the selected block. Source-read and transform failures stop the command by default. Shell execution remains available only through a clearly acknowledged privileged operation and produces structured per-block outcomes.
Key interfaces:
Acceptance criteria:
Out of scope:
Verification status:
Confirmed by code inspection: extract and update use unchecked path joining, while update and transforms log errors and continue. This issue is blocked by #5 for the structured result contract.
feat: keep metadata paths inside their base; fail fast; run needs --a…