Replace Proton-API-Bridge and go-proton-api with a client in
backend/protondrive written against Proton's current Drive API, following
the behaviour of Proton's official Drive SDK:
- volume-based and v2 routes only
- upload block verification, signed manifests and extended attributes
- current content encryption (v4 node keys, v6 PKESK, SEIPDv2)
- browser (session fork) sign-in, with username and password still
supported
- the volume's change events, used to keep the metadata cache current and
for ChangeNotify, polled at most every 30 s
- an in-memory fake Proton server (protontest) so the tests run without
an account
Uses ProtonMail/gopenpgp/v3 and ProtonMail/go-srp directly; no cgo.
Written with heavy AI assistance (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since the jlaffaye/ftp v0.2.3 bump in v1.76.0, the IP in the PASV reply
is ignored unless trust is opted into, which breaks servers whose PASV
reply legitimately points at a different data host. Add an opt-in
trust_pasv_ip option (default off) that passes DialWithTrustPasvIP to
the library.
This reverts commit a68480093c.
The next commit gives the same speedup to all backends by implementing
io.WriterTo on operations.ReOpen, using a buffer from the pool.
This type checks all the backends looking for config which is saved
with a key which isn't one of the backend's config options. Unlike the
runtime check, this catches config saved in config flows which the
tests don't exercise.
The 2FA code and bucket ID stored in the config file had no config
options, so weren't marked sensitive and were shown in clear by rclone
config redacted.
The username, legacy setup password and verification code stored in
the config file had no config options so weren't marked sensitive and
were shown in clear by rclone config redacted.
This adds config options for all the values jottacloud stores in the
config file. The device and mountpoint can now be set with
--jottacloud-device and --jottacloud-mountpoint.
The 2FA auth session stored in the config file during setup had no
config option, so it wasn't marked sensitive and was left in clear
in the output of rclone config redacted if setup was abandoned.
redact these values in the debug log:
- password and sensitive flags set from environment variables, also
in the error for an invalid value
- the client secret from jottacloud config
- the token after a bad token response from shade
- the login_token used to open the rc web gui
mark these backend options as sensitive so they are redacted:
- internxt: token
- linkbox: web_token
- oracleobjectstorage: sse_customer_key, sse_customer_key_sha256 and sse_kms_key_id
- pikpak: captcha_token and token
- s3: ibm_api_key
- shade: token
pikpak needs a captcha token for every API call. The backend fetches one,
caches it, and refreshes it when it expires; the token source did those
refreshes with the context it was constructed with, stored in a field.
That context does not live as long as the token source does.
Re-authorization rebuilds the token source with the context of one API
call, so when that call finished every later refresh failed with "context
canceled", and nothing would ever replace the stored context again. The
cached token hid this until it expired, so a mount worked for a while and
then failed every request until it was restarted.
The failed fetch was also wrapped in fserrors.FatalError, which turns a
transient error into an unrecoverable one: sync cancelled the whole run
with "Cancelling sync due to fatal error" and exited with the fatal code.
Pass the context of the request that needs the token instead, and return a
failed fetch as an ordinary error so that only the operation that needed
the token fails. The next request fetches a token with a live context.
Filen treats names which differ only in case as the same name, but the
backend didn't set the CaseInsensitive feature. Syncing "Photos/a.txt"
onto an existing "photos/a.txt" uploaded it as a new file, which
replaced the existing one on Filen, and then failed to delete the old
name with "file_is_versioned" on every run.
Set CaseInsensitive and treat parent paths which differ only in case
as the same directory when moving. Allow DirMove when the destination
found is the source directory itself, which is a case-only rename.
Reading a range from a zip entry decompresses it from the start and
discards the data before the offset, so each chunk of a multi-thread
download re-read the entry. Disable multi-thread downloads for zip
files.
Seafile ignores Range requests on encrypted libraries, so each chunk
of a multi-thread download fetched the file from the start and threw
away the data before its offset. Disable multi-thread downloads for
encrypted libraries.
Open turned the range and seek options into an offset and count, but it
never sent a Range header. It downloaded the file from the start and
threw away everything before the offset. Multi-thread copies open each
chunk separately, so a 5 GiB file in 80 chunks pulled about 200 GB from
the server and took over 30 minutes instead of under one. rclone mount
and resumed transfers were affected the same way.
Download through lib/rest, which turns the range and seek options into
a Range header. The FileLu file servers answer Range requests with 206
Partial Content.
Fixes#10305
Swift clusters without the bulk middleware in the proxy pipeline answer
bulk delete requests with 403 Forbidden. Rclone then failed to delete
large objects with "Operation forbidden", and when a segmented upload
failed its segments were left behind, silently using up space.
When BulkDelete returns swift.Forbidden, rclone falls back to deleting
each segment with ObjectDelete. A segment that is already gone counts
as deleted, as it does in a bulk delete. Any other error is returned
as before. Both removing a large object and cleaning up after a failed
upload go through the same helper.
Co-authored-by: Walter Doekes <1225014+wdoekes@users.noreply.github.com>
The zstd support removed the default from the --compress-level option
and made it required. When no level was configured the option was left
at its zero value, which meant no compression for gzip and an invalid
encoder level for zstd.
Restore the -1 default which selects the default level for the chosen
mode, and translate it to zstd's default level of 2. Also implement the
documented zstd level 0 by storing files uncompressed, and validate
levels when creating the Fs so bad values fail immediately instead of
hanging.
The compression goroutines now close the pipe with the encoder error and
the results channels are buffered, so an encoder or upload error can no
longer leave the transfer blocked forever waiting for EOF.
Fixes#10227
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
FSUM marks hashes other than MD5 with the algorithm, as in
"<hash> ?SHA1*<file>", and writes one line per algorithm per file.
Use marked lines only for the requested hash type, and prefer them to
unmarked lines.
The seafile backend shares one pacer per server URL, and the pacer
enforces minSleep between the start of any two requests. Uploading a
file takes two requests (get the single use upload link, then POST the
file), so with a 100ms minSleep the backend could start at most about 5
files per second whatever --transfers was set to.
Measured against a Seafile 13 server, uploading 40 files of 150k with
--transfers 4 took 8.4s before and 1.2 to 2.1s after. Large files are
not affected. Going below 10ms gave no further gain as the server then
becomes the limit, so use the same 10ms that most other backends use.
Errors still back the pacer off up to maxSleep as before.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Open never checked the HTTP status of the download, so when the URL
endpoint answered with an error such as 404 or 502 the error page was
returned as the contents of the file.
Return an error for anything but 200 and 206. Also build the request
with the context and send it with the rclone HTTP client, so that
cancellation, timeouts, proxies and the other HTTP options apply.
Before this change the Seafile backend reported that it doesn't support
modification times, so a file uploaded by rclone got the time of the
upload as its modification time and rclone compared files by size only.
A file which changed without changing its size was not seen as changed
by sync or bisync - in both directions.
Since Seafile server 12.0.4 the upload API reads an optional
last_modify field (RFC 3339) and uses it as the modification time of the
uploaded file (haiwen/seafile-server#666). rclone now sends this field
when the server is 12.0.4 or newer and reports a precision of 1 second
there. The time still can't be changed without uploading the file again,
so SetModTime keeps returning fs.ErrorCantSetModTime and rclone uploads
the file again when only the time differs. Older servers behave as
before.
Tested against Seafile Server CE 13.0.28 (docker image): a file uploaded
with rclone now lists with its original modification time (to the
second), and bisync picks up same-size changes on both sides. The
backend integration tests give the same results with and without this
change (the existing failures are unrelated to modification times), and
the modification time tests (ObjectModTime, FsPrecision) pass.
The precision in docs/data/backends/seafile.yaml is updated to 1s, as
reported by the current Seafile docker image.
Fixes#8337
The US3 provider was added as provider/us3.yaml, but providers are
loaded by name from provider/<name>.yaml, so "US3" was never found.
The config wizard and `rclone config providers` offered US3, yet a
remote set to it logged
s3 provider "US3" not known - please set correctly
and ran with the Other quirks: path style addressing instead of
virtual hosted, and listings without URL encoding.
Rename the file to match its name, and test that every listed
provider loads by its name.
Before this change the API key had to be exported with the Filen CLI
and pasted into the config.
Now rclone config logs in with the email, password and an optional
two-factor authentication code and saves the API key it receives. A
remote without an API key logs in once on first use and saves the key,
provided two-factor authentication is not enabled.
The api_key option is still accepted but is now optional and advanced.
Apply metadata overrides and the metadata mapper before queuing a
server-side copy. Preserve the new update tracker and read-only file
attributes, and return metadata errors before sending a PUT.
Fixes#7901
Assisted-by: OpenAI Codex
Co-authored-by: david.castro <david.castro@refinery89.com>
On Windows os.Root.Symlink always makes a file symlink when the
target is an absolute path outside the root, and Windows can't
traverse a file symlink as a directory. The planted link can't reach
the outside files, so the test failed setting up the attack with "The
filename, directory name, or volume label syntax is incorrect".
Skip the test on Windows as the other planted symlink tests do.
With -l/--links the local backend recreates a source ".rclonelink" as a real
symlink at the destination. DirMove created the parent of the destination
directory by path, which follows a symlink in any parent component, so when
the destination contained a planted symlink "pwn" pointing outside the root
a directory move to "pwn/moved" moved the directory outside the destination.
rclone's sync and the VFS never name a destination through a symlink, so this
was only reachable with a caller supplied name.
Create the parent through os.Root when translating symlinks, as the other
writes do, so a planted symlink can no longer redirect the move out of the
destination.
With -l/--links the local backend recreates a source ".rclonelink" as a real
symlink at the destination. Remove and Rmdir deleted by path, which follows a
symlink in any parent component, so when the destination contained a planted
symlink "pwn" pointing outside the root, an object or directory named through
it such as "pwn/secret" resolved to the outside file or directory and was
deleted there. rclone's own sync never names destination paths through a
symlink as the listing shows it as a ".rclonelink" file, but the clean up of a
failed copy looks up and removes a ".partial" name derived from the source,
and callers of the rc API or the Go API may pass such a name directly.
Delete through os.Root when translating symlinks so a planted symlink can no
longer redirect the removal out of the destination. This also covers the
removal of a partially written file after a failed write. In-tree removals
and the Windows sharing violation retry are unchanged.
With -l/--links the local backend recreates a source ".rclonelink" as a real
symlink at the destination. MkdirMetadata checked whether the directory
already existed with a plain lstat, which follows a symlink in any parent
component. When the destination contained a planted symlink "pwn" pointing
outside the root and the target held an existing child "sub", syncing a source
directory "pwn/sub" found the outside directory, skipped the confined Mkdir
(which would have refused the path) and went on to apply the source's metadata
to it. The mode, time and user metadata writes are individually confined, but
the birth time write on Windows was not, so an untrusted source could set the
creation time of a directory outside the destination.
Do the existence check through os.Root when translating symlinks so a path
through a planted symlink is refused up front, whatever metadata follows. The
check is unchanged when not translating symlinks.
With -l/--links the local backend faithfully recreates a source ".rclonelink"
as a real symlink at the destination. Directory and file metadata writes
(chmod/chown/chtimes/btime) are confined to the destination with os.Root so a
symlink planted by an untrusted source can't redirect them outside it. The
user metadata write (user.* xattrs) was not confined though: setXattr called
xattr.LSet on the raw path, which doesn't follow the leaf but does follow any
symlink in the parent components. When the destination already contained a
planted symlink "pwn" pointing outside the root and the target held an
existing child "sub", syncing a source directory "pwn/sub" with --metadata
set attacker chosen user.* xattrs on the outside directory, and reported
success as the confined mode and time writes had nothing to do.
Write the xattrs through a descriptor opened under os.Root when translating
symlinks, so a planted symlink can no longer redirect the write out of the
destination, while legitimate in-tree writes are unaffected. A write only
file which can't be opened for reading is opened for writing instead so its
owner can still set xattrs on it. Translated links are themselves the leaf
and keep the non-following path based write.
Every download sends the app token (X-Auth-Token) and the session
token (X-User-Token) to the download URL handed out by the API so that
premium access is recognised. The http client followed any redirect
from that URL with Go's default policy, which only strips Authorization
and Cookie style headers on a change of host and never looks at the
scheme, so both tokens were forwarded to any host the download server
redirected to, including over plaintext HTTP.
The client now uses rest.StripHeadersOnCrossHostRedirectFn, so it
refuses to follow a redirect which downgrades HTTPS to HTTP and strips
both tokens from any redirect which leaves the host and port of the
original request, matching the b2, s3, webdav and http backends.
The two-factor authentication step of the config flow checked whether
the server URL started with a slash rather than ended with one, so a
URL which already ended in a slash had another appended and the token
request went to "//api2/auth-token/".
The seafile backend used Go's default redirect policy, which copies the
Authorization header onto a redirect to the same host even when the
redirect downgrades from HTTPS to plaintext HTTP. A server or proxy
which issued such a redirect would cause the long lived Seafile API
token, or the user's password during the 2FA configuration flow, to be
sent in cleartext where anyone on the network path could read it.
Refuse to follow redirects which downgrade HTTPS to HTTP, as the webdav
backend already does.
Every NetStorage request carries the account name and a request
signature in the X-Akamai-ACS-Auth-Data and X-Akamai-ACS-Auth-Sign
headers, with the signed operation in X-Akamai-ACS-Action. The http
client followed any redirect with Go's default policy, which only
strips Authorization and Cookie style headers on a change of host and
never looks at the scheme, so all three headers were forwarded to any
host the NetStorage endpoint redirected to, including over plaintext
HTTP. The signature is bound to the path and action but can be
replayed for that same request within the server's time window.
The client now uses rest.StripHeadersOnCrossHostRedirectFn, so it
refuses to follow a redirect which downgrades HTTPS to HTTP and strips
the three headers from any redirect which leaves the host and port of
the original request, matching the b2, s3, webdav and http backends.
A v2 or v3 auth request posts the user's password, or the application
credential secret, to the auth server in a JSON body which net/http
can rewind. On a 307 or 308 redirect to another host it resent that
body, password included, to the new host.
The transport now refuses to follow a redirect which leaves the host
and port of the original request if it would resend the request body.
Every Swift storage request carries the account scoped session token
in the X-Auth-Token header, and a v1 auth request carries the user
name and API key in X-Auth-User and X-Auth-Key. The swift library
makes its own http.Client with Go's default redirect policy, which
only strips Authorization and Cookie style headers on a change of host
and never looks at the scheme, and it does not let rclone replace that
client. So the token, or the API key, was forwarded to any host the
storage or auth server redirected to, including over plaintext HTTP.
rclone does supply the library's Transport, so the redirect policy is
now applied there instead: the transport refuses to follow a redirect
which downgrades HTTPS to HTTP and removes the three headers from any
hop once the redirect chain has left the host and port of the original
request, matching the b2, s3, webdav and http backends.
A server which redirects an https:// request to an http:// URL makes
rclone replay the request in cleartext. Any credentials the backend
sets as headers are then readable by anyone on the network path, and
the response can be altered in transit.
The transport now refuses to follow such a redirect, so this holds for
every client built on it, including those of libraries which install
their own redirect policy. Use --allow-https-downgrade to follow the
redirect anyway, for example when downloading from a mirror which
redirects to plain HTTP.
Backends which check redirects themselves still refuse a downgrade
which would send their credentials in cleartext, regardless of the
flag.
If the server sent the whole file, or a different range, in response
to a ranged download rclone returned it as if it were the requested
range, which gave wrong data when seeking.
Check the response with rest.CheckContentRange and return an error if
it doesn't satisfy the requested range. fs.ErrorRangeIgnored lets
multi-thread copies fall back to a single stream.
This guards against Graph serving downloads itself after the
retirement of pre-authenticated (tempauth) URLs.
See: #10070
Microsoft is retiring pre-authenticated (tempauth) URLs in OneDrive for
Business and SharePoint from April 1, 2027. After that the download
redirect, upload session and copy monitor URLs need a SharePoint token,
which the Graph URL tenant setting doesn't change for upload sessions
or the copy monitor.
When SharePoint returns one of these URLs without tempauth rclone now
gets a token for the SharePoint host by redeeming the existing refresh
token, which works with the existing Graph consent so no reconnect or
config change is needed. Pre-authenticated URLs are still called
without authentication, so nothing changes until Microsoft retires
them.
If no SharePoint token can be got, for example with client credentials
using a secret, files under 250 MiB are uploaded in a single request
instead and server-side copies fall back to download and upload. A
copy monitor which redirects to the new item, as authenticated ones
do, is treated as finished, a refused monitor fails straight away
instead of polling until the timeout, and 401 errors explain the
retirement.
See: #10070
The help for these options named flags that do not exist, so copying
them gives "unknown flag": --sse-customer-key(-base64) is
--b2-/--s3-sse-customer-key(-base64), --azurefile-upload-concurrency is
--azurefiles-upload-concurrency and --ignore size is --ignore-size.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Presigning failed with "not found: FixupRequest" for providers with
use_x_id or sign_accept_encoding set to false, breaking rclone link,
the link backend command and use_presigned_request uploads.
Presigning replaces the Signing middleware with PresignHTTPRequest
before APIOptions run, so anchor the request fixups on whichever is
present.