Is it possible for a hacker to modify my data that gets put into offline pouchdb then syncs to online couchdb? Yes I will have ssl enabled on the server.
In my current setup. vue.js spa for pwa deployment.
const response = await this.postService(
{
_id: newId,
dateCreated: date,
updated: [],
viewed: [],
viewedCount: 0,
approved: true
},
sync
);
I'm sending this obj to function to put obj into local pouch db and then syncs to online couchdb. Now if someone can edit the obj data approved: true I would be in a lot of trouble trying to ban a user.
postService(dataObject, sync) {
// to do make sure couchdb had validation function
var self = this;
// to do this.$store.dispatch("PostServiceSynced", false);
return postsOffDb
.put(dataObject)
.then(function(response) {
// to do enable sync
// if (sync) {
// sync offline to online db
postsOffDb.replicate
.to(postsOnDb, {
live: true,
retry: true,
back_off_function: function(delay) {
if (delay === 0) {
return 1000;
}
return delay * 3;
}
})
.on("change", function(change) {
// yo, something changed!
console.log("posts replicate change", change);
})
.on("complete", function() {
// yay, we're done!
console.log("postsOffDb replicated");
})
.on("error", function(err) {
// boo, something went wrong!
console.log("err", err);
return response;
});
// }
return response;
})
.catch(function(err) {
console.log("postService err", err);
}
return err;
});
},
My work around would be send the obj to a middleware express.js add the default data like approved: true there. Then send it to couchdb. But then I would miss out on a reason to use the syncing services of couchdb I may as well go with mongodb? Anybody have the know how?