ipld / roadmap

IPLD Project Roadmap
10 stars 2 forks source link

2019 OKRs #2

Closed mikeal closed 1 year ago

mikeal commented 5 years ago

It's time to start defining the goal posts we'd like to reach by the end of 2019. I've started drafting a few and would love some feedback.

Objective: Common data-structures are available in IPLD.

Objective: Structured indexes of IPLD graphs are available.

Objective: Developers can easily use encrypted data-structures.

Objective: Applications are built and adopted using IPLD data-structures.

Objective: unixfs-v2 is widely implemented.

Objective: There is a replication alternative to Bitswap.

vmx commented 5 years ago
  • Key Result: Specification and implementation in 2 languages of an efficient B-tree (sorted collections).

I would rephrase it to of an efficient sorted collection (e.g. B-tree) as I'm not sure if it will be an B-tree. I would also reduce it to 1 language. I think the focus should be on getting it working in one, rather than having two half finished implementations. Once one is done, the other should be easy.

  • Key Result: Specification and implementation in 2 languages of an efficient R-tree (geo-spatial sorted collection)

I would rephrase it to: of an efficient multi-dimensional collection (e.g. R-tree). Those collections don't need to be sorted (they could be, but likely are not). I would also reduce it to 1 language for the same reason as mentioned above.

As I'm still unsure how hard this would be and I rather see a future in search, I might even make this one a "nice to have" and not a key result. So perhaps a new KR could be (which doesn't really fit the objective yet):

Objective: Developers can easily use encrypted data-structures.

This sounds like a huge one. Has anyone already put thought into this? I would probably move that to 2020 or change it to something like "Ideas around encrypted data-structures are noted down".

  • Key Result: unixfs-v2 is implemented as a stand-alone library in Node.js.

Isn't this automatically done with the "unixfs-v2 is implemented in js-ipfs" one?

  • What kind of goals should we have for replication?

Objective: There is an alternative to Bitswap

mikeal commented 5 years ago

@vmx

Isn't this automatically done with the "unixfs-v2 is implemented in js-ipfs" one?

The current unixfs implementation in JS isn't exactly standalone, it is a single module but it basically requires all of IPFS in order to function. I mean something more along the lines of https://github.com/mikeal/js-unixfsv2-draft which is currently written to the old unixfsv2 draft.

mikeal commented 5 years ago

Objective: Developers can easily use encrypted data-structures.

This sounds like a huge one. Has anyone already put thought into this? I would probably move that to 2020 or change it to something like "Ideas around encrypted data-structures are noted down".

I've actually been thinking about this a lot lately and there's a model I want to try using WebAssembly. The wasm work for this is likely to be done anyway for IPFS/libp2p so it shouldn't be very hard at all to implement the approach I'm thinking about, which would be a self-implemented encryption format for any IPLD object that supports the data model.

vmx commented 5 years ago

Thanks @mikeal for updating. Things look good to me!

Stebalien commented 5 years ago

I've actually been thinking about this a lot lately and there's a model I want to try using WebAssembly. The wasm work for this is likely to be done anyway for IPFS/libp2p so it shouldn't be very hard at all to implement the approach I'm thinking about, which would be a self-implemented encryption format for any IPLD object that supports the data model.

So, decryption with webasm is a bit tricky. We cannot, ever, ever pass private data (keys) into untrusted code. That means we can't pass our private key into a function referenced by the encrypted data. Instead, we have to make the key itself point to the decryption algorithm.

Also, there's still the structure/privacy tradeoff. We could:

  1. Encrypt outside the structure (hiding the IPLD structure)
  2. Encrypt inside, leaving unnamed "links" so we can at least fetch an entire dag.
  3. Create some transformed/encrypted DAG. You can get some really nice privacy properties here but it's a really hard problem.
mikeal commented 5 years ago

Safety is sort of the whole point of WASM so I wouldn't exactly call it "untrusted." It has no access to the filesystem, to the network, to any other sys calls, or any memory other than the slab you explicitly give it. Is there a particular scenario you're worried about that would allow the key to leak?

Stebalien commented 5 years ago

Is there a particular scenario you're worried about that would allow the key to leak?

Side channels, including the human side channel.

For example, let's say I have a shared filesystem and an attacker can change the "decrypt" program. In that case, the attacker can:

  1. Create a custom "decrypt" function that, in addition to decrypting a directory, modifies the ACL on the directory to give the attacker access.
  2. Attach this custom decrypt function to a directory it can't decrypt.
  3. Convince someone with access to modify the directory. The directory will be re-encrypted with the new ACLs, giving the attacker access.

Note: the solution is simply to make the decryption key itself the program. That is, if someone gives me both the key and the decryption program at the same time, I know that they already knew the "secret" inputs to the function so there's no security issue.

mikeal commented 5 years ago

I'm not following.

mikeal commented 5 years ago

Here's an illustration to try and make things clearer:

// Encrypted Block
{ @encryption: 
 { to: Binary(), // public key
   from: Binary(), // public key
   decrypt: Link() // link to raw node of wasm code.
 },
 data: Binary(),
 links: [
   Link() // link to another encrypted node that is referenced in the encrypted data.
 ],
}
Stebalien commented 5 years ago

I can take an existing IPLD object with existing encrypted data and then create a new object with the same encrypted data but with a new program. I can then give it to you and say "I made this, please decrypt it".

mikeal commented 5 years ago

Why would I decrypt a data-structure that references a specific decryption program with some random program you give me instead?

mikeal commented 5 years ago

Another thing to consider, if there is a standardized interface like this for IPLD then you're just going to ask the IPLD Interface API to decrypt things for you and pass in the private key or some kind of key manager interface. That API won't even have the option of running a decryption program that isn't reference by the node itself.

Stebalien commented 5 years ago

Why would I decrypt a data-structure that references a specific decryption program with some random program you give me instead?

Given a data structure of the form { decryptionProgram: good, data: encryptedSecret }, an attacker would create a new data structure of the form { decryptionProgram: bad, data: encryptedSecret }.

Really, there's a simple solution: attach the decryption program to the key. That is:

key = {
  decrypt: ...,
  encrypt: ...,
  other: ...,
  secret: "key data"
}

You'd then call key.decrypt(key, message) to decrypt message.

mikeal commented 5 years ago

My bad, this shouldn't be closed yet, I thought it was about the Q1 OKR's.

momack2 commented 5 years ago

anything on graphsync/selectors spec going to make it into Q1? We have an important use case for having that implemented mid-year, so it isn’t something we can put off until later quarters without consequences... I know it feels blocked right now, but I think unblocking it and getting it ready for go development in Q1 seems valuable

vmx commented 5 years ago

@momack2: the Graphsync related one is the "Demo of IPLD replication without Bitswap" one.

mikeal commented 5 years ago

@momack2 what use case is that? Is there a link to the details? We need to understand the use case in order to prioritize replication features that will support it.

rvagg commented 1 year ago

closing for archival