Skip to content

SEC: Git delivery: a checked-out symlink lets a plan overwrite a file outside the worktree (Codex F3) #446

Closed

Description

@ephico2real2

Part of #286. Found by Codex (another model family) reviewing the Git delivery layer on main b8ee59e (PRs #288, #299), 2026-11-19. Severity per Codex: High.

Location: cmapi/src/cmapi/core/git/workspace.py:397–:403; lexical checks at :350; folder reads deliberately ignore symlink blobs at :281.

Put namespace.yaml in main as a symlink to a writable file outside the worktree. The manifest reader omits it, so it can look like an absent manifest. _build then follows that symlink with write_text. The later “nothing to commit” error does not undo the external file overwrite. The regression uses a real committed symlink and proves the outside sentinel changes on main, even though push_branch raises.

Full fix: reject any symlink in the target's components inside the checkout before writes or deletes. Validate the unstripped folder as a repository path. Appendix C: workspace.py _check_files/_build.

Test: test_repository_symlink_cannot_overwrite_outside_worktree: fails main; passes fixed, with the outside sentinel unchanged after the fixed refusal. This protects repository-provided symlinks; hostile concurrent mutation by another process with the same UID is not a proven security boundary.

Evidence: workbench/cmapi/review-288b/codex-report.md (F3) and its regression test in codex-fixes.patch; Codex ran it failing on main and passing with its fix. Reviewer 2 (OB3) checks the fix and runs the PostgreSQL and SSH checks the sandbox could not, before it is applied.

Activity

  1. added
    bug
    status:open
    sev:high
    Backlog
    on Nov 19, 2026
  2. added
    Done
    and removed
    Backlog
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Donebugsev:highstatus:open

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions