Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295251

EntityChangedConstraint relies on hidden form value to set changed date, causing data loss on non Node entity types

$
0
0

Problem/Motivation

In NodeForm we put the currently changed timestamp in the form and sent it to the client, for later overwrite error checking, so that we prevent the current user from saving the node, if the node got saved by another user in the meantime.

The problem is, we set the changed in the form as hidden default_value, which means the user might manipulate it.

More importantly, EntityChangedConstraint seems to rely solely on this element existing which it doesn't for other entity types. For example Block Content has the constraint but does not throw an error in the same circumstances listed below. This could lead to data loss.

Steps to reproduce:

  1. Create a node.
  2. Go to node/{node}/edit.
  3. Save the node in the background to cause the entity changed constraint validator to raise an error.
  4. Submit the form.
  5. As a result you get the validation error message " The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.".
  6. Now manipulate the changed timestamp and set it to the current time in the DOM using Firebug or whatever...
  7. Submit the form again.
  8. Watch how you succesfully overcome the entity changed constraint validator.

The attached test shows the problem.

Proposed resolution

None at the moment.

Remaining tasks

Find a solution of the problem.

User interface changes

none

API changes

none

Data model changes

none


Viewing all articles
Browse latest Browse all 295251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>