Skip to content

Attachments are public via API #35

Closed

Description

@BaileyJM02

Hey, firstly, I'd like to say I'm absolutely loving this so far. Has been exactly what I've been trying to find for a while! Looking forward to what has to come 💪.

Bug

Once a user has uploaded an attachment (such as their profile avatar) it is available at https://example.com/api/attachments/img/avatar/<image-id>.<ext>, or an image within a document at https://example.com/api/files/<id>/<image-id>.<ext>.

These endpoints are accessible by non-authenticated users and require no authentication.

Proposed Solution

These endpoints should only be allowed if the user is authenticated and currently logged in. Or at minimum, a configuration parameter to set the /api/attachments endpoint to require authentication.

Activity

  1. Philipinho commented on Jul 1, 2024

    @Philipinho
    Member

    In my original design,

    1. Avatar images will be visible to anyone with the URL. I want to avoid making too many permissions checks.
    2. File attachments will be visible to those who have permission to the pages they belong to. I have deviated a bit for now because my initial checks required too many DB calls to get the right permissions than I would like. I will revisit this sometime soon.

    @Public()
    @UseGuards(JwtAuthGuard)
    @Get('/files/:fileId/:fileName')
    async getFile(

    I appreciate your input, and I would love to hear what others think too.

  2. archef2000 commented on Jul 1, 2024

    @archef2000

    Files should be private. imo

  3. denysvitali commented on Jul 2, 2024

    @denysvitali

    Either private, or use something similar to presigned URLs

  4. Philipinho commented on Jul 5, 2024

    @Philipinho
    Member

    Attachments added to pages will inherit the space/page permissions.
    Fixed in v0.2.3, please upgrade to the latest version of Docmost.

  5. added a commit that references this issue on Jul 1, 2025
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions