Prevent users from modifying the reserved _replication_* fields

Only the replicator is permitted to do this. This PR enhances the
existing VDU to prohibit users from modifying the fields, in case the
user mistakenly believes that such edits are understood as
instructions to the replicator.
diff --git a/src/couch_replicator/src/couch_replicator_js_functions.hrl b/src/couch_replicator/src/couch_replicator_js_functions.hrl
index d410433..1c49f52 100644
--- a/src/couch_replicator/src/couch_replicator_js_functions.hrl
+++ b/src/couch_replicator/src/couch_replicator_js_functions.hrl
@@ -58,6 +58,21 @@
             return;
         }
 
+        // Only the replicator may change these fields, though any authorised
+        // user may delete them.
+        if (oldDoc) {
+            var keys = Object.keys(newDoc)
+            for (var i = 0; i < keys.length; i++) {
+                var key = keys[i];
+                if (key.indexOf('_replication_') === 0 &&
+                    typeof(oldDoc[key]) === 'string' &&
+                    typeof(newDoc[key]) === 'string' &&
+                    oldDoc[key] != newDoc[key]) {
+                    reportError('Only the replicator may modify the ' + key + ' field.');
+                }
+            }
+        }
+
         if (newDoc._replication_state === 'failed') {
             // Skip validation in case when we update the document with the
             // failed state. In this case it might be malformed. However,