Skip to content

file_storage: list/get/download/visibility endpoints have no owner check (any user role sees every file) #544

Closed

Description

@antosubash

modules/file_storage/file_storage/endpoints/api.py list_files, get_file, download_file and update_file (→ visibility.set_public) are gated only by permission (file_storage.download / upload) plus the tenant filter. The platform user role carries UPLOAD and DOWNLOAD (module.py register_permissions), and on a single-tenant install every row is in DEFAULT_TENANT_ID, so any user-role account can list and download every stored file and toggle any file public — including other users' uploads and branding assets.

Fix direction: decide the intended model. Likely: non-admin callers see and change only rows they created (created_by == principal), and file_storage.manage (or admin) sees all. Apply the scope in the service query so list/count/get agree, and add tests with two ordinary users.

Found in the security review of #525.

https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions