-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: false positive csrf error in remote functions
#14309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: a4083e8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
This isn't a bug, it's intentional — there shouldn't be a situation in which you're calling a remote function from a different origin. Are you using |
|
Oops, sorry then, wasn't aware of that 😅. I've set the environment variables from the documentation in my .env. ORIGIN=https://mydomain.localhost
PROTOCOL_HEADER=x-forwarded-proto
HOST_HEADER=x-forwarded-hostI'm using export async function handle({ event, resolve }) {
console.log(event.request.headers.get('origin')); // null
console.log(event.url.origin); // http://mydomain.localhost
console.log(event.request.headers.get('host')); // mydomain.localhost
console.log(event.request.headers.get('x-forwarded-proto')); // https
return await resolve(event);
}The documentation you sent only refers to node server, not |
|
IMO, we should simply disable this check in development mode. |
Hey there 👋,
I think a bug was introduced in
0.36.0with #14021. Thecommandandformremote functions ignore thecsrfconfiguration.My app was successfully working on
0.35.0, and with0.36.0I get this error:If I downgrade my remote calls start working again.
After looking a few in recent PRs: previously, the error was behind a
csrf_check_origin, and it isn't anymore, allowing for false-positive CSRF errors.I think this fixes the issue. Thanks for the amazing work on kit 😉!
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits