Details
Controls that held
The same harness confirmed that ordinary traversal is still rejected, so this is not generic ../ traversal:
GET /api/resources/../u2/secret.txt?checksum=sha256did not succeed as the restricted user.GET /api/resources/%2e%2e/u2/secret.txtdid not succeed (encoded dot-dot).POST /api/resources/../u2/new.txtdid not create/u2/new.txt.PATCH /api/resources/own.txt?action=rename&destination=/../u2/moved.txtdid not move a file outside scope.
Affected code
users/users.go (scope setup); files/file.go (stat, readListing); http/raw.go (getFiles); http/resource.go (writeFile destination); http/tus_handlers.go (tusPostHandler, tusPatchHandler); http/share.go; http/public.go; http/http.go:90-91 (public routes); http/data.go (string-only path checks).
Remediation
Resolve symlinks and verify that the resolved target remains inside the user's real scoped root before any file operation — serving, sharing, writing, truncating, renaming, copying, or deleting. Specifically:
- Call
WithinScope(which resolves every path component withfilepath.EvalSymlinks) for all paths instat(), not only when the final element is a symlink. This closes the ancestor-symlink gap (Variant 2). - Add a
WithinScopecheck beforeMkdirAll/OpenFileintusPostHandlerandtusPatchHandler, so a not-yet-existing leaf cannot skip containment. - Omit entries whose resolved target escapes the scope from
readListing, and skip them ingetFilesbefore stat/open/recursion. - Apply the same resolved-path check consistently to public share creation and public share serving.
- As an alternative or defense-in-depth, reject symlinks for file operations unless an explicit administrator option enables them.
Add regression tests covering symlink reads, overwrites, TUS create/write, public shares (download, share-info, listing, and archive read paths), and the existing dot-dot controls — plus a positive test confirming that legitimately in-scope symlinks still resolve.
Limitations and non-claims
- This is not generic
../path traversal; dot-dot and encoded dot-dot controls held in the route-level tests. - This is not a proxy-auth confusion issue; the proofs use normal authenticated requests for a restricted user (and, for Variant 2's share case, an ordinary public-share recipient).
- The proofs assume the relevant symlink already exists inside the scoped tree, or that another allowed workflow in the deployment can place it there — for example an SMB/NFS export, a Docker bind-mount, or an admin-created link. Web-UI-only creation of the symlink from scratch was not demonstrated.