Page MenuHomePhabricator

Session authentication in Parsoid REST API
Closed, ResolvedPublic


Parsoid's HTTP API uses our session cookie for authentication. We should support that directly.

Event Timeline

Anomie added a subscriber: Anomie.Apr 17 2019, 1:31 AM

As it will be embedded within MediaWiki, chances are we can just let the existing MediaWiki SessionManager code handle it.

Tgr added a subscriber: Tgr.Apr 19 2019, 4:53 PM

I imagine we'll still call Setup.php and that takes care of authentication. OTOH there should probably be a way for API endpoints to declare themselves sessionless.

If by "API endpoints" you mean the REST endpoint as a whole before REST routing, that's possible as is done for load.php and a few others already.

If you mean the individual routed endpoints, that seems like it could be tricky as you'd need to somehow get the endpoint configuration before calling Setup.php, which in turn would make it hard to use MediaWiki's configuration and extension-loading mechanism to define the endpoints.

Tgr added a comment.Apr 19 2019, 8:48 PM

Individual endpoints, yeah. Session setup takes a nontrivial amount of time and most GET endpoints won't need it (the action API tends to mix public and private data, e.g. show redacted usernames if you have the permission to see them; in the REST API we probably don't want that as it makes responses uncacheable). I don't think it's hard, just an an extension point in Setup.php (pretty much everything else is loaded by that point), but something to think about.

A somewhat related issue is that currently any request with a session cookie on it bypasses Varnish; we won't want that, since it kind of defeats the point of using REST, OTOH we also don't want to leak private information every time some API module forgets to set a Vary header, so what's the right level of handling that?

Tgr added a comment.Apr 24 2019, 9:02 PM

This probably makes more sense as a subtask of T221737: REST API Infrastructure in MediaWiki now.

eprodromou closed this task as Resolved.Nov 6 2019, 6:15 PM
eprodromou added a subscriber: eprodromou.

I believe this is done.

Aklapper removed a subscriber: Anomie.Oct 16 2020, 5:38 PM