Skip to content

fix: reject symlinked LocalFile sources#2972

Open
matthewflint wants to merge 4 commits intoopenai:mainfrom
matthewflint:fix/sandbox-localfile-symlink-rejection
Open

fix: reject symlinked LocalFile sources#2972
matthewflint wants to merge 4 commits intoopenai:mainfrom
matthewflint:fix/sandbox-localfile-symlink-rejection

Conversation

@matthewflint
Copy link
Copy Markdown
Contributor

@matthewflint matthewflint commented Apr 20, 2026

Summary

  • route LocalFile reads through the pinned LocalDir path handling
  • reject symlinked ancestor and leaf source paths
  • revalidate fallback LocalDir parent directories before accepting opened files
  • add focused regression coverage

Testing

  • uv run pytest -q tests/sandbox/test_entries.py -k "local_file_rejects_symlinked_source or local_dir_copy_fallback_rejects_swapped_parent_directory or local_dir_apply_fallback_rejects_source_root_swapped_to_symlink_after_validation"
  • uv run ruff check src/agents/sandbox/entries/artifacts.py tests/sandbox/test_entries.py

Signed-off-by: matthewflint 277024436+matthewflint@users.noreply.github.com

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a00da33af

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/sandbox/entries/artifacts.py Outdated
@seratch seratch marked this pull request as draft April 20, 2026 21:26
@seratch seratch changed the title Reject symlinked LocalFile sources fix: reject symlinked LocalFile sources Apr 20, 2026
@github-actions github-actions Bot added the bug Something isn't working label Apr 21, 2026
Route LocalFile reads through the same pinned path handling used by LocalDir so symlinked source paths are rejected consistently. Add focused regression coverage for symlinked ancestor and leaf paths.
Signed-off-by: matthewflint <277024436+matthewflint@users.noreply.github.com>
@matthewflint matthewflint force-pushed the fix/sandbox-localfile-symlink-rejection branch from ea303bd to 5d16cdd Compare April 21, 2026 16:31
@matthewflint matthewflint marked this pull request as ready for review April 21, 2026 16:32
@matthewflint
Copy link
Copy Markdown
Contributor Author

matthewflint commented Apr 21, 2026

Rebased this onto current main, tightened fallback LocalDir parent revalidation, and force-pushed the updated LocalFile hardening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:sandboxes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant