Skip to content

CSRF middleware still being applied #43

@jasonmccreary

Description

@jasonmccreary

Hey-o! I'm very interested in using this package for Shift. Unfortunately, I wasn't able to get the demo to work.

I dug around a bit, and it seems the wire-extender.js isn't sending the headers (e.g. X-Wire-Extender). In addition, the URI being called is not livewire/update, but livewire/embed. Without these the isLivewireUpdateRequest returns false and the default VerifyCsrfToken middleware is applied.

Even with these the middleware still fails when checking the payload. My component had name directly. Not under snapshot.memo.name.

-            $snapshot = json_decode($component['snapshot'], true);
-            $component = $snapshot['memo']['name'] ?? false;
+            $component = $component['name'] ?? false;

In the end, I was able to get my component working with session data (auth user) after bypassing the additional header and URI checks, as well as changing the payload structure.

I'd love to see this package working as intended. I'm glad to help in any way I can. But I'm not very familiar with Livewire internals to know the right way to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions