webdav: fix HTTPS to HTTP redirects leaking credentials GHSA-h4mf-4v27-hggj

A server that redirects an HTTPS request to a plaintext HTTP URL on the
same host would cause Go's http.Client to replay the configured
credentials (Basic Authorization, cookies, secret headers) over the
network in cleartext.

Refuse to follow such downgrade redirects by default in lib/rest and wire
the webdav backend's client to use it. The `auth_redirect` option remains
the opt-in escape hatch for servers that legitimately need auth preserved
across redirects.

Fixes GHSA-h4mf-4v27-hggj
This commit is contained in:
Nick Craig-Wood
2026-07-31 13:21:59 +01:00
parent ed983c952d
commit 59b513b0e7
3 changed files with 185 additions and 0 deletions
+6
View File
@@ -180,6 +180,10 @@ to an unknown webserver.
However this is desirable in some circumstances. If you are getting
an error like "401 Unauthorized" when rclone is attempting to read
files from the webdav server then you can try this option.
Note that enabling this also permits sending your credentials over a
plaintext HTTP connection if the server redirects from HTTPS to HTTP,
which rclone otherwise refuses to do.
`,
Advanced: true,
Default: false,
@@ -511,6 +515,8 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
rt: ntlmssp.Negotiator{RoundTripper: t},
}
}
// Refuse redirects that downgrade HTTPS to plaintext HTTP.
client.CheckRedirect = rest.RefuseHTTPSDowngradeRedirectFn
f.srv = rest.NewClient(client).SetRoot(u.String())
f.features = (&fs.Features{