Skip to content

Harden read/copy/move path operations and enforce no-overwrite semantics#1

Merged
GhaziAlibi merged 3 commits into
mainfrom
copilot/check-code-for-updates
May 23, 2026
Merged

Harden read/copy/move path operations and enforce no-overwrite semantics#1
GhaziAlibi merged 3 commits into
mainfrom
copilot/check-code-for-updates

Conversation

Copilot AI commented May 23, 2026

Copy link
Copy Markdown
Contributor
  • Locate occurrences of "ALIBI Ghazu"
  • Run baseline validation (cargo test --verbose)
  • Update author name to "ALIBI Ghazi"
  • Re-run validation
  • Run parallel validation checks

Agent-Logs-Url: https://github.com/GhaziAlibi/softpath/sessions/cf3e7309-c5c7-40a5-85af-529908a69b40

Co-authored-by: GhaziAlibi <123127137+GhaziAlibi@users.noreply.github.com>
Agent-Logs-Url: https://github.com/GhaziAlibi/softpath/sessions/46c4f7f5-2b5a-41bc-a85c-a588dbc1a029

Co-authored-by: GhaziAlibi <123127137+GhaziAlibi@users.noreply.github.com>
@GhaziAlibi GhaziAlibi marked this pull request as ready for review May 23, 2026 22:58
@GhaziAlibi GhaziAlibi merged commit 978dc45 into main May 23, 2026
1 check passed

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

Copy link
Copy Markdown

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: 8c3eaa78b9

ℹ️ 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".

let dest_path = dest.as_ref();
crate::utils::check_path_traversal(dest_path)?;
crate::utils::check_symlink_cycles(dest_path)?;
if dest_path.exists() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Detect existing destination entries without following symlinks

move_to now relies on dest_path.exists() to enforce no-overwrite semantics, but Path::exists() returns false for dangling symlinks (and some metadata errors). In that case this guard is bypassed and fs::rename can still replace the destination path entry, so an existing symlink at dest is overwritten even though this change intends to reject all pre-existing destinations. This affects any call where dest is a broken symlink; use a symlink-aware existence check (for example via symlink_metadata/try_exists handling) before rename.

Useful? React with 👍 / 👎.

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.

2 participants