Skip to content

share: show directory structure - #880

Merged
pulsejet merged 2 commits into
pulsejet:masterfrom
Cl00e9ment:structured-shared-folder
Oct 20, 2023
Merged

pulsejet merged 2 commits into
pulsejet:masterfrom
Cl00e9ment:structured-shared-folder

Conversation

@Cl00e9ment

@Cl00e9ment Cl00e9ment commented Oct 19, 2023 •

Copy link
Copy Markdown
Contributor

Implemented feature request #324

Security considerations

API endpoint /api/folders/sub is now marked as @PublicPage, but I removed the path information from the returned data. This was the absolute path, revealing the name of folders outside the share. The web client now compute the path by itself, see bellow.

Some points to check before merging

  • If a folder child is in a folder parent, the web client assumes that its path is {parent path}/{child name}. Looking at the code that was present before, it seems that it may not be always the case? Maybe?
  • Route /s/{token}/authenticate/{redirect} is in conflict with /s/{token}/{path}. It's only an issue if you refresh the page on a directory which parent is named authenticate, which parent is the share root. So it's highly unlikely that this will cause any issue, but it's cleaner if it's addressed. How can we re-organise the routes?
  • Some HTTP requests end up with 412 because of a failed CFRS check, but I don't really understand this issue.

@pulsejet

Copy link
Copy Markdown
Owner

This looks great overall. I might just make a few minor tweaks before merging (e.g. variable names). I've also improved the sanitization logic on master which should help here (not a security issue though, since Nextcloud already sanitizes input everywhere)

If a folder child is in a folder parent, the web client assumes that its path is {parent path}/{child name}. Looking at the code that was present before, it seems that it may not be always the case? Maybe?

We can deal with this if something comes up later.

How can we re-organise the routes?

Hmm we can't; that route is given to us. Maybe it's better to use a query parameter for the path in this case? What do you think?

Some HTTP requests end up with 412 because of a failed CFRS check

Weird. Does this happen sporadically?

@pulsejet pulsejet added the feature New feature or request label Oct 20, 2023
@pulsejet pulsejet added this to the 5.6 milestone Oct 20, 2023
@pulsejet

Copy link
Copy Markdown
Owner

One important point: we need to make sure the folders the user sees in here are sharable (best to only get folders on the same internal storage). Shared folders, e.g. might not allow resharing.

@pulsejet

Copy link
Copy Markdown
Owner

FYI I'm working on merging this; so we don't get a conflict

@pulsejet
pulsejet merged commit 3d8ad4d into pulsejet:master Oct 20, 2023
@pulsejet

pulsejet commented Oct 20, 2023 •

Copy link
Copy Markdown
Owner

Route /s/{token}/authenticate/{redirect} is in conflict with /s/{token}/{path}. It's only an issue if you refresh the page on a directory which parent is named authenticate, which parent is the share root.

Left this as-is. No biggie.

we need to make sure the folders the user sees in here are sharable

I confirmed Nextcloud doesn't let you folders with shares in them. This PR doesn't change any behavior here so we can deal with this later if needed.

Thanks for the PR! 🎉

@Cl00e9ment

Copy link
Copy Markdown
Contributor Author

Thank you for this fast revue/merge!

@pulsejet

Copy link
Copy Markdown
Owner

Thanks to you! More contributions are always welcome 😄

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

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants