summaryrefslogtreecommitdiffhomepage
path: root/drive/driveimpl
AgeCommit message (Collapse)AuthorFilesLines
2025-09-03drive: fix StatCache mishandling of paths with spacesCraig Hesling2-5/+11
Fix "file not found" errors when WebDAV clients access files/dirs inside directories with spaces. The issue occurred because StatCache was mixing URL-escaped and unescaped paths, causing cache key mismatches. Specifically, StatCache.set() parsed WebDAV responses containing URL-escaped paths (ex. "Dir%20Space/file1.txt") and stored them alongside unescaped cache keys (ex. "Dir Space/file1.txt"). This mismatch prevented StatCache.get() from correctly determining whether a child file existed. See https://github.com/tailscale/tailscale/issues/13632#issuecomment-3243522449 for the full explanation of the issue. The decision to keep all paths references unescaped inside the StatCache is consistent with net/http.Request.URL.Path and rewrite.go (sole consumer) Update unit test to detect this directory space mishandling. Fixes tailscale#13632 Signed-off-by: Craig Hesling <craig@hesling.com>
2025-07-29drive/driveimpl: use sudo or su to run file serverPercy Wegmann1-3/+21
Some systems have `sudo`, some have `su`. This tries both, increasing the chance that we can run the file server as an unprivileged user. Updates #14629 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2025-07-01drive,ipn/ipnlocal: calculate peer taildrive URLs on-demandPercy Wegmann2-2/+2
Instead of calculating the PeerAPI URL at the time that we add the peer, we now calculate it on every access to the peer. This way, if we initially did not have a shared address family with the peer, but later do, this allows us to access the peer at that point. This follows the pattern from other places where we access the peer API, which also calculate the URL on an as-needed basis. Additionally, we now show peers as not Available when we can't get a peer API URL. Lastly, this moves some of the more frequent verbose Taildrive logging from [v1] to [v2] level. Updates #29702 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2025-04-09drive: fix index out of bounds when parsing request local paths (#15517)Craig Hesling4-4/+79
Fix the index out of bound panic when a request is made to the local fileserver mux with a valid secret-token, but missing share name. Example error: http: panic serving 127.0.0.1:40974: runtime error: slice bounds out of range [2:1] Additionally, we document the edge case behavior of utilities that this fileserver mux depends on. Signed-off-by: Craig Hesling <craig@hesling.com>
2025-04-07drive: fix minor typos in commentsCraig Hesling2-2/+2
Signed-off-by: Craig Hesling <craig@hesling.com>
2024-08-29drive/driveimpl: use su instead of sudoPercy Wegmann1-13/+29
This allows Taildrive to work on systems like Busybox that don't have sudo. Fixes #12282 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-06-10safesocket: add ConnectContextMaisem Ali1-3/+4
This adds a variant for Connect that takes in a context.Context which allows passing through cancellation etc by the caller. Updates tailscale/corp#18266 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2024-05-16drive: rewrite LOCK pathsPercy Wegmann6-87/+380
Fixes #12097 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-05-10drive: parse depth 1 PROPFIND results to include children in cachePercy Wegmann4-39/+368
Clients often perform a PROPFIND for the parent directory before performing PROPFIND for specific children within that directory. The PROPFIND for the parent directory is usually done at depth 1, meaning that we already have information for all of the children. By immediately adding that to the cache, we save a roundtrip to the remote peer on the PROPFIND for the specific child. Updates tailscale/corp#19779 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-05-03drive: actually cache results on statcachePercy Wegmann4-24/+39
Updates #11967 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-05-03drive: use secret token to authenticate access to file server on localhostPercy Wegmann1-1/+0
This prevents Mark-of-the-Web bypass attacks in case someone visits the localhost WebDAV server directly. Fixes tailscale/corp#19592 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-05-03drive: use secret token to authenticate access to file server on localhostPercy Wegmann1-1/+1
This prevents Mark-of-the-Web bypass attacks in case someone visits the localhost WebDAV server directly. Fixes tailscale/corp#19592 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-05-03drive: use secret token to authenticate access to file server on localhostPercy Wegmann2-10/+33
This prevents Mark-of-the-Web bypass attacks in case someone visits the localhost WebDAV server directly. Fixes tailscale/corp#19592 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-05-03drive: use secret token to authenticate access to file server on localhostPercy Wegmann1-1/+1
This prevents Mark-of-the-Web bypass attacks in case someone visits the localhost WebDAV server directly. Fixes tailscale/corp#19592 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-05-03drive: use secret token to authenticate access to file server on localhostPercy Wegmann1-1/+3
This prevents Mark-of-the-Web bypass attacks in case someone visits the localhost WebDAV server directly. Fixes tailscale/corp#19592 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-05-03drive: use secret token to authenticate access to file server on localhostPercy Wegmann5-53/+132
This prevents Mark-of-the-Web bypass attacks in case someone visits the localhost WebDAV server directly. Fixes tailscale/corp#19592 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-04-30drive: don't allow DELETE on read-only sharesPercy Wegmann2-1/+32
Fixes tailscale/corp#19646 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-04-18drive: rewrite Location headersPercy Wegmann4-8/+52
This ensures that MOVE, LOCK and any other verbs that use the Location header work correctly. Fixes #11758 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-04-04tailscale: switch tailfs to drive syntax for api and logs (#11625)Charlotte Brandhorst-Satzkorn1-7/+7
This change switches the api to /drive, rather than the previous /tailfs as well as updates the log lines to reflect the new value. It also cleans up some existing tailfs references. Updates tailscale/corp#16827 Signed-off-by: Charlotte Brandhorst-Satzkorn <charlotte@tailscale.com>
2024-04-03tailscale: update tailfs functions and vars to use drive naming (#11597)Charlotte Brandhorst-Satzkorn5-11/+11
This change updates all tailfs functions and the majority of the tailfs variables to use the new drive naming. Updates tailscale/corp#16827 Signed-off-by: Charlotte Brandhorst-Satzkorn <charlotte@tailscale.com>
2024-04-02tailscale: update tailfs file and package names (#11590)Charlotte Brandhorst-Satzkorn23-0/+2741
This change updates the tailfs file and package names to their new naming convention. Updates #tailscale/corp#16827 Signed-off-by: Charlotte Brandhorst-Satzkorn <charlotte@tailscale.com>