Repository navigation
Closed
Labels
Milestone
Description
背景
texrun はユーザーまたは AI エージェントが生成した TeX ソースや関連ファイルを扱う。
engine を直接任意のディレクトリで実行するのではなく、compile ごとに明示的な workspace を作成する。
スコープ
この Issue では OS レベルの完全な sandbox までは扱わず、ファイル境界を明確にするための workspace abstraction を実装する。
作業内容
- compile ごとに一時 workspace を作成する
- 入力の範囲(project root)を定義する。
texrun compile main.texの場合、既定では entrypoint を含むディレクトリを root とし、その配下を workspace にコピーする想定。--root <dir>での上書き可否は Add thetexrun compileCLI command #6 と合わせて決める - コピー時に除外するものを決める(
.git/、既存の build 出力、巨大ファイルなど)。サイズ上限は Add execution limits and define the sandbox boundary #9 と連携する - symlink の扱いを決める(推奨: root 外を指す symlink は拒否、または実体をコピーせずエラー)
- 入力に含まれる
latexmkrc/.latexmkrcの扱いを決める(Perl として実行されるため、Implement the TeX Live engine with latexmk #5 で-norcを使う前提でも workspace に持ち込まない方針が安全) - entrypoint を workspace 内の相対パスとして扱う
- 入力ファイルを workspace に materialize できるようにする
-
../等による path traversal を拒否する - absolute path の入力を拒否または明示的に扱う
- output directory を分離する
- compile 後に必要な artifact だけを収集する
- cleanup 方針を定義する
- デバッグ用途で workspace を保持できる設計余地を残す
非スコープ
- container / gVisor / microVM
- TeX primitive 自体の完全な隔離
- network namespace
これらは別 Issue で扱う。
テストケース
- 正常な nested path
../secretの拒否- absolute path の拒否
- root 外を指す symlink の拒否
- entrypoint が root 外 / 存在しない場合のエラー
- 同名 output の扱い
- 複数 compile の workspace が衝突しないこと
完了条件
- engine が host 上の任意パスではなく、texrun が管理する workspace のみを入力として受け取る構造になっている
- 上記テストケースが unit test として存在する
依存
- Define the compile domain model and engine interface #3(
CompileRequest/ path の表現)
補足
workspace 分離は「入力ファイルの境界」であり、TeX engine が \input{/etc/passwd} のように絶対パスを読むことはこれだけでは防げない。engine 側の読み取り制限は #5 / #9 で扱う。
Activity
nishide-dev commentedon Sep 30, 2026
PR #20(#3)レビューからの申し送り:
CompileOptions.output_dirは既定.texrun/out(workspace root 相対)。入力コピー時に.texrun/を除外すること。CompileRequest::validate()でInvalidRequestにする(字句チェック)。CompileContextのWorkspaceRootを受け取る。Implement isolated compile workspaces #4 はこれを生成・所有する managed workspace を提供する。feat(core): define compile domain model and engine interface (#20)
docs(security): define the MVP security model and execution limits (#22)
feat(workspace): exclude nested output directories by path (#38)
chore(ci): generate release notes from conventional commits (#62)