fix(weave): resolve symlinks on write targets; refuse escapes from the repo root - #107
Merged
Merged
Conversation
…e repo root weave ops joined repoRoot with the declared target and wrote to the result with no symlink resolution. pack.yaml runtime_links symlink store content into repos (_bmad/_config -> the frozen store version), so a csv_injection, memory_injection, or slash_command targeting a path under such a link wrote THROUGH it into producer-validated store content. Since the store freeze (#106) this failed loudly; before it, it was silent store corruption. resolveWriteTarget now resolves the deepest existing ancestor of the target (the tail may not exist yet for shim creation), resolves the repo root the same way, and refuses any target whose resolution lands outside the root. The check is by resolution, never by path spelling: legacy repos carrying a real _bmad/ tree resolve inside the root and weave there exactly as before. Refusals surface as Failed actions naming the resolved destination, consistent with the weave error model. Also covers ../ traversal out of the declaration. Verify ops stay unresolved-read: checking what the repo actually resolves to is their job. Closes: aae-orc-a3v6 (bd) Refs: finding-002 F8, docs/sideshow-requirements.md R3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A weave declaration targeting a path under a runtime_links symlink (e.g.
_bmad/_config/...) wrote straight through the link into the frozen store, corrupting producer-validated content shared by every repo on the machine. Verified live in a shimmed repo (bd aae-orc-a3v6); since the store freeze (#106) it fails loudly, before it it was silent.The fix adds
resolveWriteTarget: resolve the deepest existing ancestor of the target and the repo root the same way, refuse any target whose resolution lands outside the root, and surface the refusal as a Failed action naming the resolved destination (weave's existing error model). The check is by resolution, not path spelling, so legacy repos with a real_bmad/tree (aae-orc-vaqh) weave exactly as before;../traversal is covered for free. Verify ops deliberately keep reading through links since checking what the repo resolves to is their job.Applied to all three write ops (csv, memory, shim; patch is a stub). Tests: three write-through refusals against the live repro shape, legacy real-tree pass-through, resolver units (in-repo symlink allowed, missing tail, dot-dot, symlinked repo root). Additive guard; no behavior change for in-repo targets.