Implement per-user note directory isolation with filesystem sandboxing #10

Open
opened 2026-02-25 16:05:12 +01:00 by libretech · 0 comments
Owner

Summary

Ensure each tenant's notes are stored in an isolated filesystem directory with proper sandboxing to prevent cross-tenant data access.

Design

  • Each user gets a dedicated directory: data/{user_id}/
  • All file operations scoped to the user's directory
  • Path traversal prevention (canonicalize and validate all paths)
  • Symlink following disabled within user directories

Implementation Tasks

  • Create user directory on first login/registration
  • Modify note CRUD operations to scope to user directory
  • Add path validation to prevent directory traversal (../, symlinks)
  • Add filesystem permission enforcement
  • Write tests for path traversal attack vectors

Security Considerations

  • Must prevent ../ path traversal attacks
  • Must prevent symlink-based escapes
  • Must validate all file paths against user's root directory
  • Race condition protection on file operations

Acceptance Criteria

  • Each user can only access their own notes directory
  • Path traversal attempts return 403/404
  • Symlink-based escapes are blocked
  • Unit tests cover all known traversal vectors
## Summary Ensure each tenant's notes are stored in an isolated filesystem directory with proper sandboxing to prevent cross-tenant data access. ## Design - Each user gets a dedicated directory: data/{user_id}/ - All file operations scoped to the user's directory - Path traversal prevention (canonicalize and validate all paths) - Symlink following disabled within user directories ## Implementation Tasks - [ ] Create user directory on first login/registration - [ ] Modify note CRUD operations to scope to user directory - [ ] Add path validation to prevent directory traversal (../, symlinks) - [ ] Add filesystem permission enforcement - [ ] Write tests for path traversal attack vectors ## Security Considerations - Must prevent ../ path traversal attacks - Must prevent symlink-based escapes - Must validate all file paths against user's root directory - Race condition protection on file operations ## Acceptance Criteria - [ ] Each user can only access their own notes directory - [ ] Path traversal attempts return 403/404 - [ ] Symlink-based escapes are blocked - [ ] Unit tests cover all known traversal vectors
libretech added the
phase-1
label 2026-02-25 16:05:12 +01:00
libretech changed title from Per-user note directory isolation to Implement per-user note directory isolation 2026-02-28 20:24:02 +01:00
libretech added the
task
label 2026-02-28 20:24:19 +01:00
libretech changed title from Implement per-user note directory isolation to Implement per-user note directory isolation with filesystem sandboxing 2026-03-01 20:31:26 +01:00
libretech added the
backend
security
labels 2026-03-01 20:32:20 +01:00
Sign in to join this conversation.
No description provided.