mojo.js icon indicating copy to clipboard operation
mojo.js copied to clipboard

Features for 2.0 and beyond

Open kraih opened this issue 3 years ago • 5 comments

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

  • Core framework
    • [x] Application mount support (app.plugin(mountPlugin, {app: fooApp, path: '/prefix'}))
    • [ ] Nested helpers (ctx.foo.bar(...))
    • [ ] Custom URL class with better manipulation methods (like Mojo::URL)
    • [ ] Express middleware support (maybe as a plugin with request and response object emulation)
    • [x] Proxy helpers (ctx.proxyGet(), ctx.proxyRequest())
  • Assets
    • [x] URL generation (ctx.urlForAsset('foo.js') returns /static/assets/foo.abcd1234.js)
    • [x] Headers to prevent caching for assets in development mode (foo.development.js)
  • Documentation
    • [ ] Port testing guide to JavaScript
    • [ ] Port all reference documentation examples to JavaScript
    • [x] Form validation with JSON schema
    • [ ] Many more recipes for the cookbook (including all from Mojolicious)
    • [x] Reference documentation for classes (needs to be generated on the website)
  • WebSockets
    • [ ] Support for custom headers in handshake (client and server)
    • [ ] Support for subprotocol negotiation from action
    • [ ] Reconnect feature for the client
  • Client
    • [ ] Switch to @mojojs/user-agent (more WHATWG APIs)
    • [x] UNIX domain sockets (http+unix://...)
    • [ ] HTTP/2 support (we might just support it via the fetch API)
    • [ ] HTTP/3 support (:no_entry_sign: not yet in Node.js)
  • Server:
    • [x] UNIX domain sockets (http+unix://...)
    • [ ] HTTP/2 support (:warning: tricky because of WebSockets)
    • [ ] HTTP/3 support (:no_entry_sign: not yet in Node.js)
    • [ ] Server-Sent Events (provide an actual API)
  • Renderer
    • [ ] Port all the tag helpers
      • [x] colorFieldTag
      • [x] dateFieldTag
      • [x] datetimeFieldTag
      • [x] emailFieldTag
      • [x] fileFieldTag
      • [x] hiddenFieldTag
      • [x] labelFor
      • [x] monthFieldTag
      • [x] numberFieldTag
      • [x] passwordFieldTag
      • [x] rangeFieldTag
      • [x] searchFieldTag
      • [ ] selectFieldTag (⚠️ quite complex)
      • [x] telFieldTag
      • [x] textFieldTag
      • [x] timeFieldTag
      • [x] urlFieldTag
      • [x] weekFieldTag
  • Example apps
    • [x] Chat (ported from Perl)
  • TypeScript
    • [x] Updated app generator commands with TypeScript support
    • [x] Update plugin generator command with TypeScript support (--ts flag)
  • Command line
    • [ ] perl -Mojo -E '...' equivalent (something better than npx mojo eval -v '...'?)

kraih avatar Jun 10 '22 15:06 kraih

Would be great to have csrf_field tag helper.

tigrankhachikyan avatar Sep 28 '22 17:09 tigrankhachikyan

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.

kraih avatar Sep 29 '22 01:09 kraih

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

ralyodio avatar Oct 23 '22 08:10 ralyodio

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.

kraih avatar Oct 23 '22 12:10 kraih

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.

dmanto avatar Nov 09 '22 14:11 dmanto