Skip to content

fix(agent): guard apply_patch with secret-guard and realpath bound - #1259

Open
TheGreatAxios wants to merge 1 commit into
cl-9535-lean-prompt-pass-structured-prompts-merged-toolskill-searchfrom
cl-9622-apply_patch-re-enforces-secret-guard-and-realpath-workspace
Open

TheGreatAxios wants to merge 1 commit into
cl-9535-lean-prompt-pass-structured-prompts-merged-toolskill-searchfrom
cl-9622-apply_patch-re-enforces-secret-guard-and-realpath-workspace

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Checks every apply_patch path (add, update, delete, move target) against the secret-guard denylist, including the realpath leg and runtime extra-denied paths.
  • Bounds apply_patch to the workspace with the shared realpath resolver, so a symlink inside the workspace cannot lead out of it. Sibling worktrees and yolo mode behave as they do for write and edit.
  • Applies to both the primary and worker mounts.

Verification

  • bun run check passes.
  • Unit tests refuse an .env patch and a write through a workspace symlink to an outside directory.

Fixes CL-9622

@linear-code

linear-code Bot commented Sep 30, 2026

Copy link
Copy Markdown

CL-9622

@TheGreatAxios
TheGreatAxios added this pull request to stack #1260 September 30, 2026 16:30
@TheGreatAxios
TheGreatAxios force-pushed the cl-9622-apply_patch-re-enforces-secret-guard-and-realpath-workspace branch from d72fdc4 to b3e1b98 Compare September 30, 2026 17:35
@TheGreatAxios
TheGreatAxios removed this pull request from stack #1260 September 30, 2026 17:49
@TheGreatAxios
TheGreatAxios added this pull request to stack #1263 September 30, 2026 17:49
@TheGreatAxios
TheGreatAxios force-pushed the cl-9622-apply_patch-re-enforces-secret-guard-and-realpath-workspace branch from b3e1b98 to 3e81383 Compare September 30, 2026 18:04
@TheGreatAxios
TheGreatAxios removed this pull request from stack #1263 September 30, 2026 18:12
@TheGreatAxios
TheGreatAxios added this pull request to stack #1266 September 30, 2026 18:13
@TheGreatAxios
TheGreatAxios removed this pull request from stack #1266 September 30, 2026 20:26
@TheGreatAxios
TheGreatAxios added this pull request to stack #1273 September 30, 2026 20:27
@TheGreatAxios
TheGreatAxios removed this pull request from stack #1273 September 30, 2026 20:41
@TheGreatAxios
TheGreatAxios added this pull request to stack #1277 September 30, 2026 20:42
@TheGreatAxios
TheGreatAxios removed this pull request from stack #1277 September 30, 2026 20:56
@TheGreatAxios
TheGreatAxios added this pull request to stack #1279 September 30, 2026 20:57
@TheGreatAxios
TheGreatAxios removed this pull request from stack #1279 September 30, 2026 23:49
@TheGreatAxios
TheGreatAxios force-pushed the cl-9622-apply_patch-re-enforces-secret-guard-and-realpath-workspace branch from 3e81383 to 5c96812 Compare September 30, 2026 23:49
@TheGreatAxios
TheGreatAxios added this pull request to stack #1284 September 30, 2026 23:50
apply_patch is mounted outside the posix plugin stack, so it skipped the
secret-guard denylist and checked the workspace bound lexically only.
Every patch path now goes through the denylist and the shared realpath
resolver, on both the primary and worker mounts.
@TheGreatAxios
TheGreatAxios force-pushed the cl-9622-apply_patch-re-enforces-secret-guard-and-realpath-workspace branch from 5c96812 to 80a3be0 Compare October 2, 2026 00:25
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