Skip to content

(engine) Confine rename writes to the corpus root - #426

Merged
tcballard merged 2 commits into
mainfrom
codex/engine-confine-rename-writes
Aug 3, 2026
Merged

(engine) Confine rename writes to the corpus root#426
tcballard merged 2 commits into
mainfrom
codex/engine-confine-rename-writes

Conversation

@tcballard

Copy link
Copy Markdown
Collaborator

Summary

Implements #407, stacked on the MCP hardening series.

  • Canonicalize the requested corpus root and reject symlinked, non-regular, unresolved, or out-of-root mutation paths.
  • Recheck containment and symlink status immediately before every read and replacement; use Unix O_NOFOLLOW for the final-component race.
  • Add stable symlink-path and path-outside-root refusal codes with clear dry-run paths.
  • Add ADR-129, port-contract and CLI documentation, plus regression coverage proving an external symlink target is unchanged.

Validation

  • cargo test --workspace
  • cargo test -p asdecided-core --test rename
  • cargo clippy -p asdecided-core --all-targets -- -D warnings
  • Release build for decided and decided-mcp
  • Root corpus validate passed; Sentry full-tree gate passed with ADR-129 constraints matched

Closes #407.

@tcballard
tcballard force-pushed the codex/engine-confine-rename-writes branch from b4443d6 to 3f5c91e Compare August 3, 2026 03:58
@tcballard
tcballard changed the base branch from codex/mcp-response-budgets to main August 3, 2026 03:58
@tcballard
tcballard marked this pull request as ready for review August 3, 2026 05:54
## Summary

- make `decided rename --apply` transactional across the identity file
and inbound references
- preflight every affected file for containment, permissions, staleness,
and rendered output before any replacement
- stage rendered files as exclusive sibling files, commit via sibling
backups, and roll back in reverse order on failure
- document the recovery contract in ADR-130 and the CLI/port contract
docs

This is stacked on the root-confinement fix in #426 and closes #408.

## Validation

- `cargo test --workspace`
- `cargo clippy -p asdecided-core --all-targets -- -D warnings`
- `cargo build --release --bin decided --bin decided-mcp`
- live corpus: `decided validate decisions --json` — 449/449 checked, 0
invalid, OKF conformant
- live corpus: `decided sentry decisions --full --json` — OK, no
findings
@tcballard
tcballard merged commit 8abe4a2 into main Aug 3, 2026
7 checks passed
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.

(engine) Confine rename writes to the corpus root

1 participant