Skip to content

fix(cli): skip file symlinks in legacy directory uploads - #1922

Merged
phernandez merged 3 commits into
mainfrom
codex/security-upload-symlinks
Oct 28, 2026
Merged

phernandez merged 3 commits into
mainfrom
codex/security-upload-symlinks

Conversation

@phernandez

Copy link
Copy Markdown
Member

Why

A directory selected for legacy cloud upload includes file symlinks, and opening them uploads their targets. A regression with only temporary files reproduced disclosure of an outside file to an in-process HTTP receiver. Fixes #1898.

What Changed

Exclude discovered file symlinks before file sizing and upload. Verbose scanning identifies skipped links. Broken symlinks no longer abort otherwise valid directory uploads.

Implementation Details

Use Path.is_symlink() during discovery, complementing os.walk's existing exclusion of directory-symlink traversal. Both internal and external file links are skipped. The tests run the real discovery, asynchronous reads, HTTP client, and a FastAPI receiver via ASGITransport, without mock objects.

Stacked on #1921, which is stacked on #1920. Only the upload discovery change and its tests are new here.

Testing

  • Before the fix: both verbose modes uploaded an outside target and an internal alias; the broken-link test failed because upload aborted.
  • uv run pytest tests/cli/cloud/test_upload_symlinks.py tests/cli/cloud/test_upload_path.py tests/cli/test_upload.py -q --no-cov: 25 passed.
  • just fast-check: passed, including repository type checking.
  • just doctor: passed sandboxed write/index/search self-test.
  • git diff --check: passed.

Risks / Follow-ups

The scope is links discovered inside a directory upload. Explicitly selected input paths retain existing resolution behavior. This does not protect against a concurrent local process replacing files after discovery. Symlink tests skip Windows because link creation can require privileges. Legacy upload path authorization remains separate in #1905.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T20:33:28.380844Z ead60c4 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Base automatically changed from codex/security-project-root-ancestry to main October 28, 2026 22:16
@phernandez
phernandez changed the base branch from codex/security-project-root-ancestry to main October 28, 2026 22:16
@phernandez
phernandez merged commit d6d289d into main Oct 28, 2026
50 checks passed
@phernandez
phernandez deleted the codex/security-upload-symlinks branch October 28, 2026 22:18
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.

Keep legacy cloud uploads from following file symlinks

1 participant