Skip to content

Using .. on an alias defined to point to a directory at top level of a remote operates on the local computer #4862

Closed

Description

@rwv37

What is the problem you are having with rclone?

An Alias remote pointing to a subdirectory of the root on an S3 remote (i.e. pointing to an S3 bucket) lists the contents of my local computer's current directory when I do an rclone lsf MyAlias:..

I would expect instead that rclone lsf MyAlias:.. should behave like rclone lsf MyS3:MyBucket/.., i.e. it should list my buckets that are on the remote MyS3.

I reported this earlier today on the forum, in this thread:

https://forum.rclone.org/t/unexpected-behavior-with-alias-remote/21001

What is your rclone version (output from rclone version)

1.53.3

Which OS you are using and how many bits (e.g. Windows 7, 64 bit)

Noticed this behavior on Windows 10 64 bit, later reproduced on FreeBSD 12.1-RELEASE amd64.

Which cloud storage system are you using? (e.g. Google Drive)

Noticed this behavior on Amazon S3, later reproduced on both Google Drive and Wasabi.

The command you were trying to run (e.g. rclone copy /tmp remote:tmp)

rclone lsf A-S3-GDA-NVA:..

The rclone config contents with secrets removed.

[Dropbox]
type = dropbox
token = ...

[OneDrive]
type = onedrive
token = ...
drive_id = ...
drive_type = personal

[Wasabi]
type = s3
provider = Wasabi
env_auth = false
access_key_id = ...
secret_access_key = ...
endpoint = s3.wasabisys.com

[GSuite]
type = drive
client_id = ...
client_secret = ...
scope = drive
token = ...
root_folder_id = ...

[S3-GDA]
type = s3
provider = AWS
env_auth = false
access_key_id = ...
secret_access_key = ...
region = us-east-1
acl = private
server_side_encryption = AES256
storage_class = DEEP_ARCHIVE
bucket_acl = private

[A-S3-GDA-NVA]
type = alias
remote = S3-GDA:MyRedactedBucketName

A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)

PS D:\temp> rclone lsf A-S3-GDA-NVA:.. -vv
2020/12/12 19:28:00 DEBUG : rclone: Version "v1.53.3" starting with parameters ["C:\\rclone\\rclone.exe" "lsf" "A-S3-GDA-NVA:.." "-vv"]
2020/12/12 19:28:00 DEBUG : Using config file from "C:\\Users\\bob\\.config\\rclone\\rclone.conf"
2020/12/12 19:28:00 DEBUG : Creating backend with remote "A-S3-GDA-NVA:.."
2020/12/12 19:28:00 DEBUG : Creating backend with remote "."
2020/12/12 19:28:00 DEBUG : fs cache: renaming cache item "." to be canonical "//?/D:/temp"
2020/12/12 19:28:00 DEBUG : fs cache: renaming cache item "A-S3-GDA-NVA:.." to be canonical "//?/D:/temp"
ThisIsAFileOnMyLocalComputerInTheTempDirectoryOfMyDDrive.txt
ThisIsOneToo.txt
2020/12/12 19:28:00 DEBUG : 2 go routines active
PS D:\temp>

Activity

  1. added this to the v1.54 milestone on Dec 13, 2020
  2. ncw commented on Dec 13, 2020

    @ncw
    Member

    I can replicate this - thank you for the bug report.

    $ rclone lsf -vv s3rclone:..
    2020/12/13 09:23:03 DEBUG : rclone: Version "v1.54.0-DEV" starting with parameters ["rclone" "lsf" "-vv" "s3rclone:.."]
    2020/12/13 09:23:03 DEBUG : Using config file from "/home/ncw/.rclone.conf"
    2020/12/13 09:23:03 DEBUG : Creating backend with remote "s3rclone:.."
    2020/12/13 09:23:03 DEBUG : Creating backend with remote "."
    2020/12/13 09:23:03 DEBUG : fs cache: renaming cache item "." to be canonical "/home/ncw"
    2020/12/13 09:23:03 DEBUG : fs cache: renaming cache item "s3rclone:.." to be canonical "/home/ncw"
    

    So the problem appears to be that rclone has normalised the path wrong...

    I had a quick go at fixing this...

    if myalias points to remote:dir

    I guess we need to decide, do we want

    1. myalias:.. == remote:
    2. myalias:.. == remote:dir

    I could make an argument for either... I did the most straight forward fix, but that turns out to be option 1 and I'm not sure that is what users expect of an alias.

    Do we want the alias backend to cap the remote at the root passed in?

    The same mechanism is used for the wrapping remotes, so do we expect a crypt backend to be able to look up? I think probably not.

  3. ncw commented on Dec 15, 2020

    @ncw
    Member

    I've decided that this should cap out at the root so if you set an
    alias of s3:bucket then using alias:.. would not allow looking
    above the root of the alias. Listing alias:.. now lists s3:bucket
    as you might expect if you did cd / then ls ...

    I think allowing alias:.. to look above the intended root is a
    potential security problem waiting to happen. Witness lots of web
    server data exfiltration due to use of ...

    v1.54.0-beta.4970.7493dd856.fix-4862-fs-parse on branch fix-4862-fs-parse (uploaded in 15-30 mins)

  4. ncw commented on Dec 18, 2020

    @ncw
    Member

    I've merged this to master now which means it will be in the latest beta in 15-30 mins and released in v1.54

  5. added 2 commits that reference this issue on Jul 20, 2026
    8de302d
    4efa67d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions