Skip to content
This repository was archived by the owner on Apr 13, 2022. It is now read-only.

[proposed spec change] Mention read caps in Updates-Via - #179

Closed
michielbdejong wants to merge 2 commits into
masterfrom
update-via-caps
Closed

michielbdejong wants to merge 2 commits into
masterfrom
update-via-caps

Conversation

@michielbdejong

@michielbdejong michielbdejong commented May 29, 2019 •

Copy link
Copy Markdown
Contributor
  • Mention read caps in Updates-Via
  • Mention notification doesn't get sent if client has no read access (but leave out of scope who determines that and how)
  • Mention server is allowed to send error and informational debug messages
  • Mention server is allowed to close the connection

@michielbdejong

Copy link
Copy Markdown
Contributor Author

@acoburn @Vinnl can you review?

@Vinnl

Vinnl commented May 29, 2019

Copy link
Copy Markdown

Looks mostly good to me. I wonder if it's possible/a good idea to also have the server notify the client if it's subscribing to too many updates before it closes the connection?

@michielbdejong

Copy link
Copy Markdown
Contributor Author

Yeah, that's probably what I would implement - send an informational error message 'too many subsriptions', then close the connections. thanks!

We should discuss this in https://www.w3.org/community/solid/wiki/Meetings#20190530_1000CEST

Comment thread api-websockets.md
HTTP/1.1 200 OK
...
Updates-Via: wss://example.org/
Updates-Via: wss://example.org/?access_token=Ne3jiZ1Mei6Air6iefoh

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to tie auth into the resource address. What are the other options?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just an example, or MUST auth be connected to the Updates-Via header like this? This also suggests a high level of coordination between the resource server and the websocket server, which could run on entirely independent systems. In fact, I have a lot of questions about this sort of token structure: are these one-time tokens? how do they expire? are they revokable? are they susceptible to replay attacks?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR just updates the text from using NSS's insecure implementation as an example to using inrupt's pod-server / wac-ldp / websockets-pubsub implementation as the example.

@RubenVerborgh I don't think there are many other options, particularly Authorization headers on the upgrade request aren't a good option, because they can't be set through the web api for WebSockets. If you can think of other/better options, then please join our discussion.

@acoburn I'm currently using the PoP token as-is, so it expires for the WebSocket simply when it expires for the storage server. I think they should have an expiry of like 10 minutes, so that gives some protection against replay attacks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RubenVerborgh I don't think there are many other options

There are, and we should definitely discuss: inrupt-archived/websockets-pubsub#5 (spun off from the discussion you linked to)

Comment thread api-websockets.md
```

If a change occurs and the client is subscribed to that resource, it will
If a change occurs and the client is subscribed to that resource and has Read access to it, it will

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love that, but I'm afraid this is not how NSS works (and that is a security hole).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, and part of the reason that that wasn't fixed yet is the NSS team didn't have good way to do it, since WebSockets can't have Authorization headers when they are opened from a browser. So this is a proposal to describe a solution in the spec, and once we have a good understanding of how this can work, we should implement the same in NSS.

Comment thread api-websockets.md

The server may send additional informational messages for e.g. error reporting,
as long as they don't start with `pub`.
If a client subscribes to too many updates, the server may close the socket.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will the client know that this is the cause for closing?

Not in favor of the current phrasing; too open-ended. If we don't have a more explicit protection mechanism, let's not list a quick workaround.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there will be informational messages, then I think we should suggest what the keyword for these would be (e.g. log or info).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right that it would make sense to have such a keyword, but I don't think it's a priority.

The current spec sort of silently allows messages that don't start with pub, that's why I saw an opportunity to make that possibility more explicit here. That's a clarification, not a spec change.

If we want to introduce a new keyword, that would be a spec change, and I think we should postpone all proposed spec changes until we have first fixed two things that are more urgent for Solid app developers. The first one being clarifications (which I see as version 0.8), and then I think the second one would probably be inventing a granular sharing mechanism for apps (which I would see as version 0.9). And then maybe in version 0.10 we could add a spec change like that. Until then, my personal opinion is that such a spec change is not urgent; especially because it's already possible to start your debug messages with log or info (they would be intended to be ignored by the code but seen by the developer).

@acoburn

acoburn commented May 29, 2019

Copy link
Copy Markdown
Member

At present there are two keywords involved in this interaction: sub and pub. At what point should we start to view this interaction as a "protocol" with formal semantics. (I would be very much in favor of this). Defining a specific protocol for this would allow a client to have a clearer idea of exactly how the interaction works, and it would establish a stronger contract between client and server. As it is, the JavaScript API for establishing a WebSocket is:

WebSocket(url [, protocols])

If this specification defines a solid protocol, this would be a way to formalize these interactions. Or would that be too much complexity/overhead for what we're trying to achieve?

@michielbdejong

Copy link
Copy Markdown
Contributor Author

^ sorry, didn't want to downvote your proposal on its merits as such, you're right that there are more beautiful ways to design the protocol we have. But it's what we have, and I like that it's supersimple.

The reason I downvoted is just that I think that changing the websockets-pubsub protocol to something different but functionally equivalent (i.e., a 'mostly sideways change') would have a tiny benefit to us as Solid app developers, and a huge cost.

@RubenVerborgh

Copy link
Copy Markdown
Contributor

I'm concerned that we are making medium changes to the spec here without sufficiently stepping back and thinking about the design.

This has all grown organically; no one has ever considered whether even the pub/sub mechanism is a good idea or whether there are standard alternatives. We are currently suggesting a fix on top of a hack.

Why don't we take a step back, do requirements engineering for the sockets, and then come back with a full solution instead of putting duct tape on duct tape?

@michielbdejong

Copy link
Copy Markdown
Contributor Author

It's now implemented in IPS, but no plans (yet) to implement it in NSS. Will leave this as a proposed spec change.

@michielbdejong michielbdejong added the proposed-spec-change May or may not be adopted in future spec versions. Experimental; not yet universally supported. label Jun 18, 2019
@michielbdejong michielbdejong changed the title Mention read caps in Updates-Via [proposed spec change] Mention read caps in Updates-Via Jun 18, 2019
@michielbdejong

Copy link
Copy Markdown
Contributor Author

Do not merge unless NSS also implements this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

proposed-spec-change May or may not be adopted in future spec versions. Experimental; not yet universally supported.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants