Skip to content
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

Support websockets in proxies #204

Open
mike-marcacci opened this issue Jun 1, 2020 · 0 comments
Open

Support websockets in proxies #204

mike-marcacci opened this issue Jun 1, 2020 · 0 comments

Comments

@mike-marcacci
Copy link
Member

mike-marcacci commented Jun 1, 2020

So far we've been able to put off dealing with websockets in the proxies. We've avoided this feature largely because we are are unaware of any published standards for using expiring credentials with long-lived sockets. Additionally, following prior art (such as Heroku's model) requires shared state across instances, which is a total no-go for a tool designed as a lightweight developer convenience.

There are two obvious directions this could take:

Only send credentials when upgrading the connection

This is obviously not a great solution when using JWTs (self-contained access tokens), since it would either have to ignore the expiration timestamp, or terminate the connection on token expiration.

For revocable tokens, however, this could work quite well, since the proxy could poll AuthX periodically to verify continued validity of the credentials.

One other ding to this approach is that while this appears easy to implement over an upgrade HTTP request, the API exposed to browsers for initiating such a request provides no mechanism for specifying headers like Authorization, which means we'd still have to use some non-standard mechanism for passing credentials when the client is a browser.

Require explicit authorization messages

A more robust strategy would require the client to send periodic "authorize" messages containing a new token, in advance of the previous token's expiration. This is certainly more opinionated, but could be accomplished. A message like this could be used:

authx://authorize:(token)

Unlike HTTP, websockets don't provide us a standard mechanism for attaching metadata to messages. The HTTP resource proxy uses headers to pass decoded and verified/fetched scope information along. We could provide an option to pass this same info along in a custom message, but at that would require sufficient customization of the app that the utility provided by the proxy might as well just be written into the app itself.

However, standardizing on this or some other (perhaps similar) pattern could at least lead to basic support in the resource proxy, and provide a mechanism for websockets that could be automatically supported by the web proxy.


@krisbarrett recently implemented AuthX websocket support in an internal golang app; this will provide a lot of real-world learnings before adding inevitably prescriptive support to the proxies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant