Skip to content

Conversation

@artonge
Copy link
Contributor

@artonge artonge commented May 6, 2025

This currently prevent directly accessing a resource from a third party site.

Not sure whether public.php actually does not need auth. I am just not aware of any place where it is the case.

This currently prevent directly accessing a ressource from a third party site.

Fix #52482

Signed-off-by: Louis Chemineau <louis@chmn.me>
@artonge artonge requested a review from a team as a code owner May 6, 2025 11:22
@artonge artonge requested review from Altahrim, ArtificialOwl and nfebe and removed request for a team May 6, 2025 11:22
@artonge artonge self-assigned this May 6, 2025
@artonge artonge added bug feature: dav php Pull requests that update Php code labels May 6, 2025
@artonge artonge added this to the Nextcloud 32 milestone May 6, 2025
nfebe
nfebe previously approved these changes May 6, 2025
Copy link
Contributor

@nfebe nfebe left a comment

Choose a reason for hiding this comment

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

🐘

@artonge artonge requested review from nickvergessen and susnux May 6, 2025 12:05
@artonge artonge changed the title fix: Do not require samesite=strict cookies for public.php fix: Do not require samesite=strict cookies for public.php May 6, 2025
@nickvergessen nickvergessen requested a review from nfebe May 6, 2025 14:52
@nickvergessen nickvergessen dismissed nfebe’s stale review May 6, 2025 14:52

Yolo not allowed on the topic

@artonge
Copy link
Contributor Author

artonge commented May 6, 2025

Password protected shares are a form of authentication

@artonge artonge closed this May 6, 2025
@TomKamin1
Copy link

Hi, trying this fix i found it does in fact NOT solve the issue at hand (#52482). Any ideas what else i could try? Thank you.

@nickvergessen nickvergessen deleted the artonge/feat/do_not_require_samesite_strict_cookie_on_public.php branch May 11, 2025 05:38
artonge added a commit that referenced this pull request May 14, 2025
…endpoint

This currently prevent directly accessing a resource when clicking on a link on a third party site. Example, clicking on `https://example.com/public.php/dav/files/pqLWcA269zfzXez/?accept=zip` in a GitHub comment.

Skipping the check is an issue with password protected shares, as it allows third party sites to request the resource when the user already entered the password, aka CSRF.  So after removing the check from `base.php`, we need to add it again in the `PublicAuth` plugin.

We also add a redirect to be helpful to the user.

**Warning**: this adds the limitation that clicking on a direct download link for password protected shares will redirect you to the password form, and then to the main share view.
Another solution would be to do the redirect from the front-end.

- Fix #52482
- Improved version of original closed PR: #52657

Signed-off-by: Louis Chemineau <louis@chmn.me>
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug feature: dav php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Public share link fails with "Strict Cookie has not been found in request" and 412 Precondition Failed when clicking, but works when copy-pasting

6 participants