yorkie-team / yorkie

Yorkie is a document store for collaborative applications.
https://yorkie.dev
Apache License 2.0
761 stars 140 forks source link

Implement validation check for operations on the server side #857

Open chacha912 opened 3 months ago

chacha912 commented 3 months ago

What would you like to be added:

Currently, we only perform validation checks for operations during local updates. We apply the operation to a clone during doc.update(), and if the operation is invalid, we handle the failure. Since validation checks are performed locally, no such checks are performed when an operation is saved on the server, and propagated to remote clients.

However, there have been cases where invalid operations passed through the SDK, resulting in continuous sync-failed errors upon receiving them on the remote side and leading to duplicate application of remote-change.

Therefore, there is a need to implement checks to ensure that invalid changes do not propagate in the SDK development process. During the execution of PushPullChange on the server, we can validate the changes and fail the request if they are invalid.

Why is this needed:

To prevent the propagation of invalid changes and ensure data integrity.

Related: https://github.com/yorkie-team/yorkie/issues/805

hackerwins commented 3 months ago

Thanks for your opinion.

To validate the operations on the server, it is necessary to load the document into memory, which poses a risk of degrading the overall performance of PushPullChanges. Therefore, it would be good to create --inspection flag to validate the document's integrity only under specific runs($ yorkie server --inspection).

window9u commented 2 weeks ago

Hello!

Can I try this issue?