Skip to content

readonly_repo: symlinks to paths outside the repository stay writable #7927

Open

Description

@waynesun09

Current behaviour

readonly_repo: true is enforced in internal/cli/run.go (around line 2100) with:

find <repo> -path '*/.git' -prune -o -not -type l -exec chmod a-w {} +

-not -type l keeps find from following symlinks, so the symlinks themselves are skipped. In practice:

  • A symlink whose target is inside the repository: the target is still made read-only, because find reaches it as an ordinary file.
  • A symlink whose target is outside the repository (for example docs/x -> /tmp/somefile, or a path in the sandbox home): the target stays writable. A reviewer can write through the link. That modifies the outside file, not the repository.
  • .git: stays writable by design (chmod -R u+w .git).

Question

Should readonly_repo also guarantee that no path reachable through the checked-out tree is writable? Options:

  • Resolve symlinks that point outside the tree and chmod a-w their targets.
  • Refuse to run with such symlinks.
  • Document that readonly_repo covers the repository's own files only.

This was raised in review of #7915, which makes fullsend agent new emit readonly_repo: true for the review role, matching the fleet's review harness. That PR doesn't change the enforcement, so this is tracked separately.

Activity

  1. fullsend-ai-triage commented on Oct 1, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 3:43 PM UTC · Completed 3:47 PM UTC

    Commit: 385030f · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $0.42

  2. added
    triaged
    security
    type/bug
    component/sandbox
    priority/high
    on Oct 1, 2026
  3. fullsend-ai-triage commented on Oct 1, 2026

    @fullsend-ai-triage

    The symlink-escape gap you diagnosed in the readonly_repo enforcement checks out. The core issue — not just the choice of remediation — is a defect: a symlink targeting a path outside the checked-out repo bypasses the chmod a-w sweep entirely, so readonly_repo's guarantee silently doesn't cover it, while in-tree symlink targets happen to be protected as a side effect of find's traversal.

    No existing open issue or PR addresses this (checked #5253, #1622, and #7360, which cover different mechanisms).

    Given the project's existing fail-closed convention for other security checks and its threat model treating target-repo content as potentially attacker-controlled, the recommended default is to resolve symlinks pointing outside the tree and chmod their targets too (or fail the run if that isn't possible) rather than only documenting the limitation — details in the triage summary. A maintainer should weigh in if a different trade-off (e.g., refuse-to-run) is preferred before implementation.


    Labels: Matches this repo's convention for sandbox-related security bugs (security + type/bug + bug + component/sandbox), with priority/high reflecting that it undermines an existing security control similarly to recent sandbox CVE-style issues (#7578, #7563, #7580).


    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  4. added 2 commits that reference this issue on Nov 9, 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

    component/sandboxpriority/highsecuritytriagedtype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions