Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changeless actions corrupt audit history #330

Open
NightJar opened this issue Apr 9, 2021 · 6 comments
Open

Changeless actions corrupt audit history #330

NightJar opened this issue Apr 9, 2021 · 6 comments

Comments

@NightJar
Copy link

NightJar commented Apr 9, 2021

Upon publishing a page the "last edited" information is updated, even when no new version is created because no edits have taken place.

Reproduce:

  • Create, edit & publish page
  • Check history, notice most recent entry & record timestamp
  • Create new member with publish permissions
  • Sign in as new member (e.g. in "private window")
  • Publish the same page
  • Check History, inspect most recent entry & compare timestamp with previously recorded

Check database and see draft table "Last Edited" timestamp change, where live table and versions table for the same record & version do no have this field altered.

This holds true for CMS 3 and CMS 4 with versioned snapshots (admin).
Untested: CMS 4 without versioned snapshots

@brynwhyman
Copy link

brynwhyman commented Apr 13, 2021

@NightJar if you're project is using versioned-snapshots, I'm expecting you'd also be using silverstripe/versioned-snapshot-admin. Can you please confirm if this is the case?

@brynwhyman
Copy link

Also, @NightJar what do you think the expected result should be here?

I'm expecting it should be the following (in bold):

...

  • Sign in as new member (e.g. in "private window")
  • Publish the same page
  • Check History, and see a new published record with new timestamp, assigned to the new author

@brynwhyman
Copy link

brynwhyman commented Apr 13, 2021

Note that I can't recreate this with silverstripe-versioned + silverstripe-versioned-admin. I think this is a versioned-snapshots related issue. See:

image

@NightJar
Copy link
Author

@brynwhyman sorry for the delay.

Expectation

I expect the result to be that the Stage records LastEdited timestamp is not updated - and any admin view reflects the true time the author made the alterations to the version represented.

Whether or not there is a new version record representing no changes is debatable. Versioned inherently has a major flaw in that it attempts to track both actions and edits.

Adding a new version record would accurately track an action, but would also represent an edit where there was none.

I'm of no opinion in this matter, although I suspect that the impact of adding unaltered version records would significantly impact an already extremely heavy table (given a larger site example). I think simply aborting the process is fine - if there were to be any outcome of this action I would probably recommend a notice to the user

"I did nothing because you did nothing."

Of course, phrased a better, and voiced less like the system is a surly conscious entity.

Recreation

Sorry, this is me getting confused between many different versions and combinations of modules I've been dealing with lately.

This issue exists on silverstripe/versioned rather than silverstripe/versioned-admin as it is about the data integrity. You are accurate that versioned-admin does not display this issue, it appears to read the last edited date from the versions table as one might expect.

However, the draft content last edited timestamp is still updated although it reflects no changes. This in turn impacts both Silverstripe CMS 3 (which is out of support for this matter, but is evidence to the historic nature of this issue), and Silverstripe CMS 4 with versioned snapshots (& versioned snapshot admin), as this newer system appears to read the data from that location as CMS 3 did.

  • composer create-project silverstripe/recipe-cms historytest
  • dev/build (in order to have requireDefaultRecords populate some consistent data to test with)
  • admin/security - create second user assigned to Content Authors group
  • different browser session admin/pages/edit/show/2 as new Content Author user, alter Content and Publish
  • In database see SiteTree.LastEdited matches SiteTree_Live.LastEdited and SiteTree_Versions.LastEdited for the most recent version
  • Wait at least 1 minute (to be able to easily see differences in time stamps
  • original browser session admin/pages/edit/show/2 as Default Admin user, click Publish (without making any edits)
  • In database see SiteTree.LastEdited no longer matches neither SiteTree_Live.LastEdited nor SiteTree_Versions.LastEdited despite no new entries being inputted to the versions table

image

@unclecheese
Copy link

This seems to be an issue with CHANGE_STRICT. Here's the changes I'm getting on that changeless publish:

Screen Shot 2021-06-01 at 11.49.50.png

Seems unlikely that we could update the change level. That would be an API change, and who knows what else it would break. Seems like a better option is to get snapshot-admin to work more like versioned-admin?

@unclecheese
Copy link

Hi, @NightJar -- Keen to test out this fix? silverstripe/silverstripe-versioned-snapshots#46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants