Skip to content

"mpremote -rv :/" can remove files from host #17147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Josverl opened this issue Apr 17, 2025 · 0 comments · Fixed by #17149
Closed

"mpremote -rv :/" can remove files from host #17147

Josverl opened this issue Apr 17, 2025 · 0 comments · Fixed by #17149
Labels

Comments

@Josverl
Copy link
Contributor

Josverl commented Apr 17, 2025

Port, board and/or hardware

any

MicroPython version

mpremote v1.25.0

Reproduction

  • use mpremote mount .
  • Ctrl-C to terminate connection
  • run mpremote rm -rv :

Minimal repro: ⚠️ destructive ⚠️
mpremote mount . + rm -rv :

Expected behaviour

-rm -r :/ not to affect the local filesystem

Observed behaviour

apparently the mount was retained - and therefore the /remote , hosts filesystem, started be removed

rm :
removed directory: './.venv/Lib/site-packages/Deprecated-1.2.18.dist-info'
removed directory: './.venv/Lib/site-packages/adodbapi/examples'
removed directory: './.venv/Lib/site-packages/adodbapi/test'
removed directory: './.venv/Lib/site-packages/adodbapi'
removed directory: './.venv/Lib/site-packages/annotated_types-0.7.0.dist-info/licenses'
removed directory: './.venv/Lib/site-packages/annotated_types-0.7.0.dist-info'
removed directory: './.venv/Lib/site-packages/annotated_types/__pycache__'
removed directory: './.venv/Lib/site-packages/annotated_types'
removed directory: './.venv/Lib/site-packages/ansicon-1.89.0.dist-info'
removed directory: './.venv/Lib/site-packages/ansicon'
removed directory: './.venv/Lib/site-packages/anyio-4.9.0.dist-info'
removed directory: './.venv/Lib/site-packages/anyio/_backends'
removed directory: './.venv/Lib/site-packages/anyio/_core'
removed directory: './.venv/Lib/site-packages/anyio/abc'
removed directory: './.venv/Lib/site-packages/anyio/streams'
removed directory: './.venv/Lib/site-packages/anyio'

Additional Information

I think \remote should be special cased in mpremote rm -r to guard against this behavior

Code of Conduct

Yes, I agree

@Josverl Josverl added the bug label Apr 17, 2025
dpgeorge pushed a commit to Josverl/micropython that referenced this issue Apr 26, 2025
Removes the risk of inadvertently deleting files on the host by preventing
the deletion of files via `rm -r` on the `/remote` vfs mount point.

Fixes issue micropython#17147.

Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant