Skip to content

fix(fns): reject cross-site server function requests - #2321

Merged
brenelz merged 2 commits into
mainfrom
fix/server-function-csrf
Sep 18, 2026
Merged

brenelz merged 2 commits into
mainfrom
fix/server-function-csrf

Conversation

@lxsmnsyc

Copy link
Copy Markdown
Member

Server functions are same-origin RPC, but the handler ran them for any request to /_server regardless of origin or method, so another site could invoke a state-changing function with the visitor's cookies over a GET or a form POST. SameSite=Lax does not stop the GET vector, and the id can be given in the URL, so the custom-header preflight did not gate it either.

Reject cross-site requests before the function runs: trust Sec-Fetch-Site when present, otherwise compare Origin against the request host. Same-origin, same-site, user-initiated navigations, and no-JS form posts keep working.

Server functions are same-origin RPC, but the handler ran them for any
request to /_server regardless of origin or method, so another site could
invoke a state-changing function with the visitor's cookies over a GET or a
form POST. SameSite=Lax does not stop the GET vector, and the id can be given
in the URL, so the custom-header preflight did not gate it either.

Reject cross-site requests before the function runs: trust Sec-Fetch-Site
when present, otherwise compare Origin against the request host. Same-origin,
same-site, user-initiated navigations, and no-JS form posts keep working.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 84a9e47

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/start Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Sep 16, 2026

Copy link
Copy Markdown

Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit 84a9e47
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/6aac85a92cda9900087a1e80
😎 Deploy Preview https://deploy-preview-2321--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Sep 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/start@2321

commit: 84a9e47

@brenelz
brenelz merged commit 378cbcd into main Sep 18, 2026
13 checks passed
@brenelz
brenelz deleted the fix/server-function-csrf branch September 18, 2026 01:31
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.

2 participants