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

fix: protect share accept endpoint with CSRF token#63952
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.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants