dominictarr / scuttlebutt

peer-to-peer replicatable data structure
Other
1.32k stars 66 forks source link

Prevent incorrect changes #23

Open dolphin278 opened 11 years ago

dolphin278 commented 11 years ago

Not an issue, more of a general question — assume that my app have following scuttlebutted graph

client (browser) <-> network of app servers <-> network of storage nodes

Then, client performs an incorrect assignment to the data on it's node — what is proper way to prevent those malformed data to propagate across the system? Should I implement my own scuttlebutt that refuses incorrect changes in appyUpdates function and place it on app server?

Sorry, if it's stupid question, but I am just starting to use scuttlebutt.

dominictarr commented 11 years ago

This is a very good question, please do not hesitate to post an issue, even if it's just a clarification or about a point that was confusing in the documentation. these issues are useful for other people who have similar questions!

so, you want to have validation rules that restrict certain nodes from making certain updates?

yes, this is possible. I have experimented with this, you may want to read through this https://github.com/dominictarr/scuttlebutt/issues/6

If you read the code you'll see there is some stuff regarding validation, you could provide a hook to inject validation functions into that, I would be happy to merge a pull request for something like that.

dolphin278 commented 11 years ago

@dominictarr great, I've read code about security validation, will try to make something for general-purpose validations.

One more question — does it make sense to push into stream compensating messages when validation (in general sense) fails for specific fields trying to set previous values for fields which was set to incorrect values? Good thing is our errorneous client could refresh their data back to proper version, and bad thing is we actually make a new event on object history that could be created after some other 'good' client made some changes to data, so we effectively overwrite them by our compensating message.

juliangruber commented 11 years ago

https://github.com/juliangruber/authoritee

Put nodes running this scuttlebutt version around untrusted nodes and they'll only replicate what's good.

dolphin278 commented 11 years ago

@juliangruber :thumbsup: Great module, thank you