waterbutler icon indicating copy to clipboard operation
waterbutler copied to clipboard

[SVCS-133] Reject complicated self-overwrites

Open NyanHelsing opened this issue 6 years ago • 2 comments

Update: PR description modified by @cslzchen

Ticket

https://openscience.atlassian.net/browse/SVCS-133

Purpose

Replaces: https://github.com/CenterForOpenScience/waterbutler/pull/270

As per the instructions on the linked ticket, it is possible to silently cause files to delete themselves during intra copy/move actions. This ticket fixes this issue on the following providers it affects:

  • Box
  • Dropbox
  • GoogleDrive
  • OwnCloud

Summary of Changes

Added Code to check the full path, or identifiers of the source and destination. If they overlap (are the same) the move/copy is rejected with a 409 and an error message that "files cannot overwrite themselves".

Added and updated tests to the affected providers.

Tests and QA Notes

There are testing notes on the ticket for how to properly recreate the issue. For the 4 providers listed, copy/move with replace/keep both and rename should all be tested extensively. They should be tested with and without the setup for the bug in place

Light testing on other addons/providers should also be done.

NyanHelsing avatar Apr 27 '18 16:04 NyanHelsing

Coverage Status

Coverage increased (+0.02%) to 91.917% when pulling a2d4f2c365895d814aa2c764297bc3267e716577 on birdbrained:ft/reject-overwrites into 0e53579f80c4d62fcc5396e0a21c4c1eb951590c on CenterForOpenScience:develop.

coveralls avatar Apr 30 '18 18:04 coveralls

Update: given that your changes are only style fixes (including fixing issues introduced by yourself), I cherry-picked and rebased the full PR into 2 commits, one from Addison and one from you. I removed several unnecessary style updates as well. Your original PR is backed up in this branch.

Original Commits:

orginal-commits

New Commits:

new-commits

cslzchen avatar May 29 '18 16:05 cslzchen