mojolicious / mojo.js

:unicorn: The Mojolicious real-time web framework for Node.js
https://mojojs.org
MIT License
486 stars 34 forks source link

Features for 2.0 and beyond #66

Open kraih opened 2 years ago

kraih commented 2 years ago

With the 1.0 release quickly approaching done, it is time to make a list of features we would like to see afterwards.

tigrankhachikyan commented 2 years ago

Would be great to have csrf_field tag helper.

kraih commented 2 years ago

Would be great to have csrf_field tag helper.

That doesn't really work with JSON schema based validation. And has become kinda obsolete with SameSite cookies.

Edit: And for the record, mojo.js session cookies default to SameSite: lax. So they are reasonably well protected already, as long as you are not misusing GET routes.

ralyodio commented 2 years ago

I’d be willing to create a chat example if someone tells me how to broadcast to websocket clients

kraih commented 2 years ago

I’d be willing to create a chat example if someone tells me how to broadcast to websocket clients

The blue checkmark means it's already done.

dmanto commented 2 years ago

Would be great to have csrf_field tag helper.

That doesn't really work with JSON schema based validation. And has become kinda obsolete with SameSite cookies.

Edit: And for the record, mojo.js session cookies default to SameSite: lax. So they are reasonably well protected already, as long as you are not misusing GET routes.

Unfortunately, SameSite cookies don't protect CSRF attacks on websockets. Please see this article. So as mentioned there we would need at least to check on the Origin header or use some kind of random generated csrf token. In mojo.pl you could generate an ws(s) url with a query parameter named csrf_token, generated with the existing helper, and then validate that inside the websocket, assuring that the rest of the mojo cookies are valid.