Skip to content

Prevent apply_patch from widening write permissions - #39614

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/187109ff0b56a1a399cb8a9981b7e822977025d5
Aug 20, 2026
Merged

Prevent apply_patch from widening write permissions#39614
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/187109ff0b56a1a399cb8a9981b7e822977025d5

Conversation

@copyberry

@copyberry copyberry Bot commented Aug 20, 2026

Copy link
Copy Markdown

Prevent apply_patch from widening write permissions

Why

Deriving permissions from the parent of an already-writable patch target can
unnecessarily grant write access outside the intended workspace.

What changed

Skip targets already covered by the active filesystem sandbox policy before
deriving additional parent-directory permissions. Targets outside the writable
area continue to request the required parent access.

Testing

Added unit and CLI regression coverage for workspace-directory targets,
already-writable parents, and symlink escapes outside the workspace.

## Why

Deriving permissions from the parent of an already-writable patch target can
unnecessarily grant write access outside the intended workspace.

## What changed

Skip targets already covered by the active filesystem sandbox policy before
deriving additional parent-directory permissions. Targets outside the writable
area continue to request the required parent access.

## Testing

Added unit and CLI regression coverage for workspace-directory targets,
already-writable parents, and symlink escapes outside the workspace.

GitOrigin-RevId: 187109ff0b56a1a399cb8a9981b7e822977025d5
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/187109ff0b56a1a399cb8a9981b7e822977025d5 branch from a809a2b to 530c1ae Compare August 20, 2026 06:22
@copyberry
copyberry Bot merged commit 530c1ae into main Aug 20, 2026
28 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/187109ff0b56a1a399cb8a9981b7e822977025d5 branch August 20, 2026 06:23
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant