Skip to content

fix(auth): migrate user base paths to scoped roles - #9641

Open
okatu-loli wants to merge 1 commit into
AlistGo:mainfrom
okatu-loli:codex/fix-user-base-path-migration
Open

fix(auth): migrate user base paths to scoped roles#9641
okatu-loli wants to merge 1 commit into
AlistGo:mainfrom
okatu-loli:codex/fix-user-base-path-migration

Conversation

@okatu-loli

@okatu-loli okatu-loli commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Users whose base path matches a role scope can resolve a selected path twice (for example, /教学 becomes /教学/教学). Keep user base paths at / and migrate existing non-root restrictions into roles so upgrading does not broaden their directory scope.

Changes

  • Normalize creation, editing, and SSO/LDAP registration to /; retire default-directory settings in favor of role scopes.
  • Transactionally create and bind per-user roles using the intersection of the old base path and existing role scopes. Preserve permission bits, credentials and account state. Users already rooted at / do not get per-user roles; ordinary shared roles remain unchanged.
  • Preserve admin/guest identity. When guest grants must be split, root guest users reuse one shared template, and default registration settings retain their prior grants.
  • Propagate migration failures and record the launch version only after successful upgrades. Cover rollback/retry and repeated startup.
  • Keep root browsing from inheriting child operation permissions, retain scoped FTP/SFTP login, filter protocol directory listings, and check copy/move destination scope.
  • Avoid decoding download and WebDAV URL paths twice.

Validation

  • Related bootstrap, op, fs, common, handlers, middleware, FTP and WebDAV tests passed, including -race, plus command-package tests and application build.
  • Isolated-process SQLite migration failure/retry/restart checks passed: no partial users or roles, no version advance on failure, successful retry, no duplicate roles on restart.
  • Live HTTP/WebDAV/FTP/SFTP checks passed: scoped access, root-user preservation, guest access, directory passwords, signed special-character downloads, scoped writes, filtered root listings and rejected out-of-scope operations.
  • Full go test ./internal/... ./server/... ./cmd/... has three failures also reproduced on unmodified upstream e1c022a9: TestSecureJoin/drive on macOS, TestDownloadOrder, and the existing server/s3/backend.go:331 log-format vet error.

Compatibility

Clients must use full virtual paths after upgrading. Existing SSO/LDAP default-directory isolation becomes role-based. Coordinate release with the companion frontend PR: AlistGo/alist-web#311. Live protocol checks used local storage; external identity providers and all remote drivers were not exercised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant