Bug 126211 - Saving an existing file overwrites owner and file permissions
Summary: Saving an existing file overwrites owner and file permissions
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.1.6.3 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 126260 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-07-03 13:39 UTC by Cat65
Modified: 2021-07-07 04:14 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cat65 2019-07-03 13:39:28 UTC
Description:
If I change a file owned by another person, and save it,
1. the file will change ownership to me,
2. the file will loose all added individual permissions. It will only keep the inherited permissions from the above folder(s).

This is not the expected usual windows behaviour and can have serious side effects in professional use. E.g. if you get a inherited creator/owner permission, you suddenly have full rights for the file when you before had only the right to change the contents of the file. You can change permissions by yourself when you should not.

Tried with writer and calc, LibreOffice still version 6.1.6.3.
Tried afterwards with LibreOffice 6.2.4, seemingly additional permissions are kept now, but the owner changes still, the owner will get full rights if inherited creator/owner permissions are present from the above folder, the previous owner could probably get less, inherited permissions.
Before version 6 I had 5.2.5.1. So I reverted to 6.0.7.3, everything is okay with it.

Perhaps the problem is somehow related to bug 125401.

Please fix it as soon as possible, especially in the still version.

Steps to Reproduce:
1. Create a file with inherited and manually permissions
2. Change the owner to someone else.
3. Edit the file and save it.
4. You will become owner and the file will keep only the inherited permissions.

Actual Results:
Original owner and permissions are overwritten.

Expected Results:
Owner and permissions should be kept.


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 Mike Kaganski 2019-07-03 14:24:10 UTC
Indeed, it's related to the same change that caused tdf#. And that it's fixed incompletely in 6.2 is likely to

> Security resource attributes (ATTRIBUTE_SECURITY_INFORMATION) for the original file are not preserved until Windows 8 and Windows Server 2012

mentioned in https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-replacefilea. So possibly the OS information missing in the report is Windows 7?

Seems that we need to disable the fastpath for Win7 case.
Comment 2 Mike Kaganski 2019-07-03 14:31:16 UTC
Forgot to set NEEDINFO needed for further steps: please mention the affected OS, and put back to UNCONFIRMED. Thanks.
Comment 3 Mike Kaganski 2019-07-03 14:35:35 UTC
Also strange that it's problematic with 6.1.6 - that version should behave identically to 6.2, because the fix was backported to 6.1.3...
Comment 4 Cat65 2019-07-03 18:14:28 UTC
The OS versions are Windows 10 Pro 64 bit, 1809 and 1803, but also Windows 7.

Why 6.2 behaved differently, I am not sure anymore. Perhaps I tested with a different file with other inherited and added permissions.
Comment 5 Mike Kaganski 2019-07-04 03:58:05 UTC
Confirming wrt owner change (in 6.2 and current master). There's no use to check 6.1, since no new builds will be released there anyway. I can't check at the moment how the behavior differs in case of Windows 7.

I am not sure what to do here. The new behavior is consistent with major Windows applications, like MS Word, or Autodesk AutoCAD. So I'm inclined to close this as WONTFIX, given that permissions are kept correctly now.

I'm not closing this right now, to have some time to think this over.
Comment 6 Oliver Brinzing 2019-07-07 09:14:05 UTC
*** Bug 126260 has been marked as a duplicate of this bug. ***
Comment 7 QA Administrators 2021-07-07 04:02:46 UTC Comment hidden (obsolete)
Comment 8 Mike Kaganski 2021-07-07 04:14:43 UTC
As mentioned in comment 5, this is consistent with other software on Windows. I don't think we have some better way of dealing with the OS security model.

Closing WONTFIX. Please reopen if you have a good idea how to deal with this, taking into account that new data is not written directly into the older file, but new file is created side-by-side with the old file, filled with the new data to avoid damage on write failure, and then after the write is finished, the old file is deleted or renamed to backup, and the new one is renamed to the old name.