Skip to content

Refuse replay record paths inside any Git work tree at run time - #252

Merged
nervouna merged 1 commit into
mainfrom
237-replay-record-work-tree
Nov 23, 2026
Merged

nervouna merged 1 commit into
mainfrom
237-replay-record-work-tree

Conversation

@nervouna

Copy link
Copy Markdown
Owner

Summary

Fixes #237

replay engine --record checked the output path only against CARGO_MANIFEST_DIR/../.. and accepted any path when
that directory no longer existed. A binary built in another worktree, or moved after the build, could therefore write
a record holding typed text into the repository it was run from.

outside_repository now canonicalizes the output directory and refuses it when any ancestor holds a .git entry
(directory or worktree file). The compile-time root stays as a second rule for source trees without .git. The
caveat in Core/Portable/README.md that pointed at this issue is replaced by the rule.

Acceptance

  • bash macOS/scripts/test.sh portable: PASS 1 units: portable (192 s).
  • Synthetic checkout: engine_arguments_and_record_files_are_checked builds a scratch directory outside this
    repository, marks it (and then only its nested directory) with a .git file, and asserts that --record into it
    is refused with "outside the repository" and that nothing is written. The compile-time root cannot match that
    path, so the test exercises the run-time rule alone.
  • Output outside any work tree: the existing engine-mode tests still record to the temporary directory; the
    owner-only mode and the refusal to write over an existing file are unchanged and still asserted.

Deviations and open issues

The rule is "inside any Git work tree", which is wider than "inside the current InkFlow work tree": a record cannot
be written into an unrelated repository either. Typed text has no place in any repository, and the rule needs no
knowledge of the working directory or the executable's location.

cargo fmt is not installed for the local toolchain, so formatting was done by hand.

Delivery record

Implementer model Implementer tokens Rework rounds Dispatch to merge Defects found in review Defects found in acceptance
claude-fable-5-2 0

🤖 Generated with Claude Code

outside_repository compared the output path only with the checkout that
compiled the binary and accepted every path when that checkout was gone.
A binary built in another worktree, or moved, could write typed text into
the current repository. The check now walks the output directory's
ancestors for a .git entry and keeps the compile-time root as a second
rule.

Fixes #237

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@nervouna
nervouna enabled auto-merge November 23, 2026 02:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T02:01:56.066066Z 3cf0fdc PR opened
🔒 Security Review ✅ Completed 2026-11-23T02:04:10.326994Z 3cf0fdc PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@nervouna
nervouna merged commit ac43453 into main Nov 23, 2026
7 checks passed
@nervouna
nervouna deleted the 237-replay-record-work-tree branch November 23, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

按运行时工作树限制回放文本的输出路径

1 participant