Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upDEP: Ephemeral message extension #28
Conversation
pfrazee
added some commits
Jun 6, 2018
This comment has been minimized.
This comment has been minimized.
Here's a lab API I'm considering for Beaker to leverage both this and #27 https://gist.github.com/pfrazee/7259f9201d44417c777803984715e1c4 |
This comment has been minimized.
This comment has been minimized.
This is awesome! The proposed Beaker API is really elegant, too. Only questions:
|
This comment has been minimized.
This comment has been minimized.
I originally had it at 256 bytes to fit within a single packet (with some clearance) but I decided that's just too much of a pain for users. I figure we should cap it at some size to discourage DoS attacks (ie "hey parse this 100mb json message!"). I'm open to discussing the exact size, but 1kb seemed reasonable.
I figure you just drop the message. There's no acknowledgement of receipt and so an error won't come back either.
They're random per connection, at the moment. |
This comment has been minimized.
This comment has been minimized.
Also, question: In the future would it be weird if I did the "approve" review action when reviewing stuff even though I'm not part of the WG? I almost did it by reflex but wasn't sure if it would be weird to do so. |
This comment has been minimized.
This comment has been minimized.
Straight into the dungeon with you |
bnewbold
reviewed
Jun 10, 2018
My comments are a little probing/critical, but I wouldn't consider them blocking. |
# Motivation | ||
[motivation]: #motivation | ||
|
||
While Dat is effective at sharing persistent datasets, applications frequently need to transmit extra information which does not need to persist. This kind of information is known as "ephemeral." Examples include: sending chat messages, proposing changes to a dat, alerting peers to events, broadcasting identity information, and sharing the URLs of related datasets. |
This comment has been minimized.
This comment has been minimized.
bnewbold
Jun 10, 2018
Contributor
Instead of adding general purpose capabilities to the Dat protocol to support all these use cases, why not embed Dat withing application-specific protocols for each of these use cases? The protocol stack is pretty modular as-is, so it should be possible to borrow "just" features like discovery, stream encryption, etc. Hypercore is transport agnostic, so it should be possible to embed in each of these.
This is sort of a rhetorical/hypothetical question; what i'm really getting at is, are we trying to turn the hypercore protocol a general purpose distributed networking framework? If so, maybe we should draw up a roadmap of what that would entail.
This comment has been minimized.
This comment has been minimized.
pfrazee
Jun 10, 2018
Author
Member
Beaker needs a quick solution to exchanging ephemeral messages between users that reside on a dat:// site. Hypercore has an extensions mechanism for sending arbitrary message types, and so this DEP is taking advantage of that. It's a low-effort, high-return feature; just a stepping stone to the broader roadmap.
This comment has been minimized.
This comment has been minimized.
bnewbold
Jun 10, 2018
Contributor
That's good context! I'm for pushing this through as a Draft so you can move fast but still have documentation you can point at for interop.
# Reference Documentation | ||
[reference-documentation]: #reference-documentation | ||
|
||
This DEP is implemented using the Dat replication protocol's "extension messages." In order to broadcast support for this DEP, a client should declare the `'em'` extension in the replication handshake. |
This comment has been minimized.
This comment has been minimized.
bnewbold
Jun 10, 2018
Contributor
Does em
stand for "extension message" or "ephemeral message"? I would expand it to ephemeral-message
, or ephemeral
if we're trying to save bytes.
This comment has been minimized.
This comment has been minimized.
|
||
The first 6 header bits are reserved. The payload's encoding may be specified in the last two header bits. Possible values are: | ||
|
||
- `00` - binary |
This comment has been minimized.
This comment has been minimized.
bnewbold
Jun 10, 2018
Contributor
Hrm, this is pretty limited. I think it might be better to just not attempt to do content-type declaration at all rather than do it partially. An HTTP-style Content-Type header feels like the minimum viable here. How will the client know how to "decode the payload according to this encoding-value" at all if it doesn't know what the message type is (only the encoding)?
This comment has been minimized.
This comment has been minimized.
pfrazee
Jun 10, 2018
Author
Member
I'm just looking for a way to send buffers, strings, or objects. Maf had some observations about using a protocol buffer so that we can extend it more in the future, which I agree with.
This comment has been minimized.
This comment has been minimized.
bnewbold
Jun 10, 2018
Contributor
Having this be a protobuf message with two fields:
optional string contentType = 1;
required bytes payload = 2;
feels more hyper-world-idiomatic to me. For the browser use-case, I think you could also just try decoding the raw bytes as JSON, and throw a warning if it fails to parse. UTF-8 strings can be encoded as a JSON string.
This comment has been minimized.
This comment has been minimized.
pfrazee
Jun 10, 2018
Author
Member
Makes sense to me. Should we use the full mime-type? "application/json"
?
This comment has been minimized.
This comment has been minimized.
bnewbold
Jun 10, 2018
Contributor
Yup; and applications can support later variants if they want (eg, for GeoJSON, application/geo+json
)
This comment has been minimized.
This comment has been minimized.
RangerMauve
Jun 11, 2018
Contributor
I really like the idea of using mime types! It'll make packets a bit bigger, but I think it's worth the flexability it will bring.
|
||
No acknowledgment of receipt will be provided (no "ACK"). | ||
|
||
After publishing this DEP, the "Beaker Browser" will implement a Web API for exposing the `'em'` protocol to applications. It will restrict access so that the application code of a `dat://` site will only be able to send ephemeral messages on connections related to its own content. |
This comment has been minimized.
This comment has been minimized.
bnewbold
Jun 10, 2018
Contributor
I'd leave forward-looking statements ("this client will support XYZ") out of the DEP, even at draft stage. The note about expected security policy might be worth keeping though.
This comment has been minimized.
This comment has been minimized.
pfrazee
Jun 10, 2018
Author
Member
What's a better way to phrase it, do you think? Maybe as a recommendation to browser clients which implement the DEP?
This comment has been minimized.
This comment has been minimized.
bnewbold
Jun 10, 2018
Contributor
I would move it to "Motivation" and rephrase:
"A specific use case for this extension is to enable a new Web API which will expose peer message-passing channels to in-browser applications. Such an API would restrict access so that the application code of a dat://
site will only be able to send ephemeral messages on connections related to its own content."
This comment has been minimized.
This comment has been minimized.
pfrazee
added some commits
Jun 10, 2018
This comment has been minimized.
This comment has been minimized.
Changes made. I removed any max payload length. Do we want to readd that? |
This comment has been minimized.
This comment has been minimized.
Could go either way on payload length... if we do limit it i'd leave the door open to increasing the size in the future, but never decreasing the message size. |
Jun 12, 2018
This was referenced
This comment has been minimized.
This comment has been minimized.
Is this |
This comment has been minimized.
This comment has been minimized.
It would be nice to at least mention that payload size should be kept "reasonable", but I don't have specific language to recommend. I wouldn't block on that. Skimming back over this, I don't see a privacy/security section. Even as an "Informative" and "Draft", I think there should be a section, and at least a "user/developer beware" statement. This in addition to the statement under drawbacks. Off the top of my head:
That last point kind of ran on, sorry about that. It would be nice to link to the implementation of extension messages, but we don't have the wire protocol DEP published yet. For reference, the message type is 15 ( Of the above, the only thing i'd consider blocking is an additional security/privacy section. Apologies for not noticing and requesting earlier; I can draft something if you want. |
This comment has been minimized.
This comment has been minimized.
@bnewbold I'm happy to write it, and happy for you to! I'd probably steal what you wrote their either way. Just LMK |
This comment has been minimized.
This comment has been minimized.
If you're up for writing it please do, and feel free to take anything from the above. |
This comment has been minimized.
This comment has been minimized.
@bnewbold glad you suggested that section, it was needed. Ready for review. |
This comment has been minimized.
This comment has been minimized.
We should discuss in the WG meeting, but after thinking about it more I think the above security issue is serious enough that it feels like we're handing developers a foot-gun by publishing this as a DEP, even a Draft. This doesn't feel "safe by default": there is a large burden on application developers and users to understand the security/privacy semantics. |
This comment has been minimized.
This comment has been minimized.
We decided to withdraw this proposal. The WG was uncomfortable giving this spec approval given its security & privacy characteristics. Applications are (as always) free to use similar designs in their own extension messages. |
pfrazee
closed this
Jul 6, 2018
This comment has been minimized.
This comment has been minimized.
Is the session data proposal still good to go? |
This comment has been minimized.
This comment has been minimized.
@bnewbold do you have any feelings about that? It's not fundamentally different in its security & privacy properties. |
This comment has been minimized.
This comment has been minimized.
Also, if this is being revoked, does that mean the datPeers API in beaker is going away? Would it be possible to keep something like it for sessionData if it's just ephemeral messages that are going away? |
This comment has been minimized.
This comment has been minimized.
No the |
This comment has been minimized.
This comment has been minimized.
aral
commented
Jan 24, 2019
Sorry to revive a closed PR but regarding the privacy concerns, wouldn’t they be addressed by having the ephemeral messages encrypted by the feed key as part of the ephemeral extension protocol itself (instead of leaving it to userland?) It feels like this would be preferable to every userland application creating its own method of handling ephemeral messaging. |
This comment has been minimized.
This comment has been minimized.
@aral AFAIK that is the case -- all messages over the There's a lot of work planned & under way with the discovery and connection layer. Discovery is shifting to hyperswarm and connection-layer encryption is (last I heard) moving to a NOISE implementation. The reasons for this include:
|
pfrazee commentedJun 6, 2018
Another DEP proposal
This is not meant to supersede #27 and will probably be used in combination with it.