Skip to content

Conversation

@Koc
Copy link
Contributor

@Koc Koc commented Jan 5, 2026

Summary

This PR fixes 2 workarounds to download shared files without download permission.

1. Permission bypass via custom mount points

Shared files could be leaked if the recipient configured shared files to mount into a subfolder (e.g., /shares) rather than the root directory.

  • Scenario: 1. Alice shares a file with Bob and disables download permissions.
    2. Bob configures his account to mount shared files into a custom /shares folder.
    3. Bob attempts to download the entire /shares folder as a ZIP.
  • Actual Result: The restricted file is included in the ZIP.
  • Expected Result: The restricted file is excluded; the ZIP contains only permitted files or an empty folder.

2. Permission bypass after moving files

A logic gap allowed files to remain downloadable if they were moved to a subfolder before permissions were revoked by the owner.

  • Scenario: 1. Alice shares a file with Bob with download permissions.
    2. Bob moves that file into a subfolder (e.g., /work-folder).
    3. Alice updates the share to remove download permissions.
    4. Bob attempts to download the /work-folder as a ZIP.
  • Actual Result: The file is still included in the ZIP despite the permission change.
  • Expected Result: The restricted file is excluded.

TODO

  • Check more edge-cases (e.g. shared and own files located in nested folder)
  • Actualize tests

Checklist

@Koc Koc requested a review from a team as a code owner January 5, 2026 00:16
@Koc Koc requested review from come-nc, leftybournes, salmart-dev and yemkareems and removed request for a team January 5, 2026 00:16
Signed-off-by: Kostiantyn Miakshyn <[email protected]>
@Koc Koc force-pushed the bugfix/prevent-download-view-ony-files branch from f5ab743 to fc61b22 Compare January 5, 2026 00:34
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand the PR, it checks the same files twice, once as paths, once as nodes?
Why is that needed? Why was it not working before?

@Koc Koc force-pushed the bugfix/prevent-download-view-ony-files branch 2 times, most recently from 975782e to 17b40e1 Compare January 6, 2026 11:07
@Koc
Copy link
Contributor Author

Koc commented Jan 6, 2026

@come-nc

Why was it not working before?

Good question, but I don't know. For some reason we're still able to download non-downloadable files using workarounds that I explained in the PR description. I've double-tested it on master branch before PR opening.

Regarding duplicated checks - I've added one more commit that simplifies this. So, now we recursively collecting files to download only once and perform check only once. Also in previous implementation non-downloaded files break whole download (check not works, but idea was the same). Now we're just skipping such files and not break download process.

@Koc Koc force-pushed the bugfix/prevent-download-view-ony-files branch from 17b40e1 to 13673e9 Compare January 6, 2026 11:15
@Koc Koc force-pushed the bugfix/prevent-download-view-ony-files branch from 13673e9 to 26992d1 Compare January 6, 2026 11:20
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.

3 participants