agentbbs/internal/files
Kyle Paul Zengo e345845c41 fix: canonicalize root in safeJoin to handle symlinked storage roots
When the configured storage root (or a system temp dir on macOS where
/var → /private/var) is reached through a symlink, filepath.EvalSymlinks
on a child path resolves to the canonical form, but within() was comparing
against the lexical root — causing valid paths to be rejected with
"files: path escapes its area".

Fix: resolve the root once with EvalSymlinks before the symlink guard
loop, and compare resolved paths against the canonical root. The initial
lexical containment check (line 108) still uses the original root so
that the returned path keeps the caller's expected prefix.

Adds two regression tests:
  - TestSafeJoinSymlinkedRoot: valid file under a symlinked root is accepted
  - TestSafeJoinChildSymlinkEscapeStillBlocked: escaping child symlink is still rejected

Fixes #62
2026-06-29 01:31:55 +00:00
..
admin.go feat(files): SFTP member storage — private workspaces + shared public area + mgmt TUI 2026-06-23 09:35:04 +00:00
backend.go files: /me and /public are two separate per-user areas 2026-06-26 01:36:43 +00:00
e2e_test.go files: per-user public at ~name/public; home = member directory 2026-06-26 01:21:00 +00:00
files_test.go fix: canonicalize root in safeJoin to handle symlinked storage roots 2026-06-29 01:31:55 +00:00
fs.go fix: canonicalize root in safeJoin to handle symlinked storage roots 2026-06-29 01:31:55 +00:00
server.go feat(files): SFTP member storage — private workspaces + shared public area + mgmt TUI 2026-06-23 09:35:04 +00:00
tui.go feat(files): SFTP member storage — private workspaces + shared public area + mgmt TUI 2026-06-23 09:35:04 +00:00
web.go files: /me and /public are two separate per-user areas 2026-06-26 01:36:43 +00:00
web_test.go files: /me and /public are two separate per-user areas 2026-06-26 01:36:43 +00:00