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

Questions about data validation #100

Open
glensimister opened this issue Jun 16, 2016 · 4 comments
Open

Questions about data validation #100

glensimister opened this issue Jun 16, 2016 · 4 comments

Comments

@glensimister
Copy link

hi there! I have a P2P app that i want to build and i’ve recently stumbled across OrbitDB. I’m new to all this p2p stuff and i’m confused about how data validation works using a client-side db. I’m familiar with using public key cryptography to sign and verify transactions, but how would i prevent malicious users from spamming the application if i can’t perform server-side validation? Wouldn’t i need some sort of smart contract? Thanks.

@zbyte64
Copy link

zbyte64 commented Jun 16, 2016

Let me pile on another data validation question: How do we validate data when syncing with another peer?

In regards to the original question: Someday js-ipfs will be mature enough to allow the client to store their own data in the browser and use a server as a WebRTC gateway to sync with other peers. Until then we can use OrbitDB in the backend and have the server act as an oracle.

@glensimister
Copy link
Author

@zbyte64 PouchDB stores data in the browser and can use PeerPouch to replicate data over WebRTC. Also, CouchDB (which can sync with PouchDB) allows you to add validation rules (written in js) inside the database itself. When the data is replicated to other servers in the cluster, the data is checked against these rules. Something similar to that on IPFS would be cool ;)

@MikeFair
Copy link

but how would i prevent malicious users from spamming the application if i can’t perform server-side validation?

Short answer, in a strictly P2P sense, you can't. Just like you can't actually prevent them from spamming your validation server. I think what you were driving at though was an intermediary that could play referee.

Here I can point to two ideas:

  1. The library itself. This only works for actors that are using the library; most people will be using libraries that follow the "play nicely" rules. One of those rules is enforcing message validation before blasting it out to all the peers; others could be honoring message rates/bandwidth consumption limits.

Users that try and bypass the library and go direct will most likely be able to get messages sent to all the connected peers. The peers will validate these messages before applying the message and likely reject the request (assuming it's invalid).
But the malicious user can make the peers work. I'm hoping orbit-db has something similar to the bitSwap algorithm for punishing peers issuing spam and eventually severing connections with that peer.

  1. Put servers in the middle.
    At the application level create two channels; one channel listens directly to the public channel that only a few "server" peers can update, while other channel is a private messaging channel to a "server" peer. These "servers" get messages from clients; validate it; then repeat it on the public channels.

Again a malicious attacker can make the servers work; hopefully getting banned from the channel if it's malicious.

@aphelionz
Copy link
Member

Moving to the Field Manual to go into more detail

@aphelionz aphelionz transferred this issue from orbitdb/orbitdb Sep 27, 2019
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

4 participants