Skip to content

fix: protect share accept endpoint with CSRF token - #63952

Merged
susnux merged 1 commit into
masterfrom
fix/accept-file-csrf
Sep 3, 2026
Merged

susnux merged 1 commit into
masterfrom
fix/accept-file-csrf

Conversation

@kristian-zendato

@kristian-zendato kristian-zendato commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The share accept link in notification emails previously accepted the share on a single GET request, which bypass CSRF protection. This change introduces a confirmation page and moves the actual acceptance to a POST request with a CSRF token.

  • GET /apps/files_sharing/accept/{shareId} — shows a confirmation page with sharer name and file name
  • POST /apps/files_sharing/accept/{shareId} — accepts the share and redirects to the shared file (CSRF-protected)
  • Share notification emails now link to the confirmation page (showAccept) instead of accepting directly

Screenshot of Accept page

image

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@kristian-zendato
kristian-zendato requested review from a team as code owners September 2, 2026 11:27
@kristian-zendato
kristian-zendato requested review from come-nc, icewind1991, leftybournes, skjnldsv, sorbaugh and susnux and removed request for a team September 2, 2026 11:27
@susnux susnux added bug 3. to review Waiting for reviews labels Sep 2, 2026
@susnux susnux added this to the Nextcloud 36 milestone Sep 2, 2026
@susnux

susnux commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

--- Failed scenarios:

/home/runner/work/server/server/build/integration/sharing_features/sharing-accept.feature:20 (on line 32)

related error

Signed-off-by: kristian-zendato <kristian.zendato@nextcloud.com>
@susnux
susnux merged commit 7dd5289 into master Sep 3, 2026
244 of 311 checks passed
@susnux
susnux deleted the fix/accept-file-csrf branch September 3, 2026 12:35
@susnux

susnux commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

/backport to stable35

And As an "user1"
When accepting last share via the accept endpoint
And Logging in using web as "user1"
When opening last share accept confirmation page

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Might be a good idea to add a negative regression test for GET behavior as a followup.

@susnux

susnux commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

/backport to stable34

@susnux

susnux commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

/backport to stable33

@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants