voidzero-dev / voidzero-dev/vite-plus

create: overwrite follows target symlinks and deletes linked contents

オープン
#2,419 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
5.8k
フォーク
262
平均マージ
23時間 18分
マージ済み PR(30日)
139

説明

## Summary

When `vp create` targets a non-empty directory symbolic link, choosing “Remove existing files and continue” deletes files inside the linked directory instead of removing or rejecting the link itself.

The confirmation prompt only displays the target path. It does not indicate that deletion will occur in the directory referenced by that path.

## Reproduction

1. Create a directory containing a sentinel file:

```sh
mkdir linked-directory
printf 'keep\n' > linked-directory/keep.txt
```

2. Create a target directory symlink:

```sh
ln -s "$PWD/linked-directory" new-project
```

3. Start any `vp create` flow with `new-project` as its target directory.

4. When prompted, select “Remove existing files and continue”.

5. Check the linked directory:

```sh
test -e linked-directory/keep.txt
```

## Actual behavior

`linked-directory/keep.txt` is deleted. Other entries in the linked directory are also removed recursively, except for the existing `.git` preservation behavior.

## Expected behavior

The overwrite flow should not implicitly traverse the final target symlink and delete its destination contents.

It should treat the symbolic link as a distinct filesystem entry, or otherwise make the resolved deletion target explicit before performing a destructive operation.

## Impact

This can cause irreversible local data loss outside the symbolic-link entry shown by the prompt.

The trigger is limited: the create target must be a symbolic link and the user must confirm removal. This is therefore a low-frequency but high-impact local data-loss issue, not a remote security vulnerability.

## Environment

- Reproduced on macOS arm64
- Node.js v25.9.0
- Vite+ revision: `295c8d6069605a249ed39e8c5e4d4d3d79e4be3e`

A draft fix is available in #2418.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

`vp create` の上書きフローと #2418 の修正案を確認し、その後 macOS または別のローカルファイルシステムで、この issue の symlink ケースを再現します。「既存のファイルを削除して続行」が symlink エントリの外部にある内容を削除しないこと、および prompt または動作によって解決された対象が明示されることを確認できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
cli
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。