You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With WinSCP and Cyberduck, renaming or duplicating an object fails with error "the specified bucket does not exist" if versitygw is configured with an IAM backend.
To Reproduce
Start versitygw with an IAM backend (for instance IAM Internal).
Create a user.
As admin, create a bucket.
Change ownership of the bucket to the new user.
Browse the bucket with WinSCP or Cyberduck as a user.
Upload a file.
Try to rename or duplicate the file. The operation fails with error "the specified bucket does not exist".
Expected behavior
The user should be able to rename or duplicate a file with WinSCP or Cyberduck.
Server and client versions
versitygw v1.0.5 or latest revision of the "main" branch (commit 923ee5f)
WinSCP 6.3.4
Cyberduck 8.7.3
Bug analysis
To rename or duplicate an object, WinSCP and Cyberduck send a CopyObject S3 command that contains a x-amz-copy-source header that starts with '/'.
The "x-amz-copy-source" header may start with '/' as observed with
WinSCP. However, '/' is also the separator between the bucket and the
object path in "x-amz-copy-source".
Consider the following code in VerifyObjectCopyAccess():
srcBucket, srcObject, found := strings.Cut(copySource, "/")
If `copySource` starts with '/', then `srcBucket` is set to an empty
string. Later, an error is returned because bucket "" does not exist.
This issue was fixed in the Posix and Azure backends by the following
commit:
* 5e484f2 fix: Fixed CopySource parsing to handle the values starting with '/' in CopyObject action in posix and azure backends.
But the issue was not fixed in `VerifyObjectCopyAccess`.
This commit sanitizes "x-amz-copy-source" right after the header is
extracted in `s3api/controllers/base.go`. This ensures that the
`CopySource` argument passed to the backend functions UploadPartCopy()
and CopyObject() does not start with '/'. Since the backends no longer
need to strip away any leading '/' in `CopySource`, the parts of
commit 5e484f2 modifying the Posix and Azure backends are reverted.
Fixes issue versity#773.
Signed-off-by: Christophe Vu-Brugier <christophe.vu-brugier@seagate.com>
Describe the bug
With WinSCP and Cyberduck, renaming or duplicating an object fails with error "the specified bucket does not exist" if versitygw is configured with an IAM backend.
To Reproduce
Expected behavior
The user should be able to rename or duplicate a file with WinSCP or Cyberduck.
Server and client versions
Bug analysis
To rename or duplicate an object, WinSCP and Cyberduck send a CopyObject S3 command that contains a
x-amz-copy-source
header that starts with '/'.The function VerifyObjectCopyAccess contains the following code:
If
copySource
starts with '/', thensrcBucket
is set to an empty string. Later, an error is returned because bucket "" does not exist.The same issue was fixed in the Posix and Azure backends by the following commit:
However, the issue still exist in
VerifyObjectCopyAccess
.I will provide a fix for this issue.
The text was updated successfully, but these errors were encountered: