Bug 166173 - Saved DOCX is restricted in MSO
Summary: Saved DOCX is restricted in MSO
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.0.0.3 release
Hardware: All All
: medium normal
Assignee: Bayram Çiçek
URL:
Whiteboard: target:25.8 target:25.8.0 target:25.2.4
Keywords: bibisected, bisected, filter:docx, implementationError
Depends on:
Blocks: DOCX-Corrupted DOCX-Doc-Protection
  Show dependency treegraph
 
Reported: 2025-04-14 07:36 UTC by Timur
Modified: 2025-04-21 04:43 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample DOCX (12.46 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-04-14 07:36 UTC, Timur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Timur 2025-04-14 07:36:37 UTC
Created attachment 200338 [details]
Sample DOCX

Open DOCX in LO, MSO, see it can be edited.
In LO save and reopen in MSO
See that saved DOCX is restricted in MSO, for example comment cannot be inserted.
Comment 1 Timur 2025-04-14 07:45:54 UTC Comment hidden (me-too)
Comment 2 Timur 2025-04-14 08:57:51 UTC
Regression from 6.0:

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2694162969cf86ef366d3ce812fccd0630acc800

author	Serge Krot <Serge.Krot@cib.de>	2017-09-29 18:01:54 +0200
committer	Thorsten Behrens <Thorsten.Behrens@CIB.de>	2017-10-06 08:06:59 +0200
commit 2694162969cf86ef366d3ce812fccd0630acc800 (patch)

tdf#66398 Import/export docx document protection properties
Added:
+ import/export of all doc protection properties
+ unit test


If there is the line:
<w:documentProtection w:edit="forms" w:enforcement="0"/>
the export make it:
<w:documentProtection w:edit="forms" w:cryptProviderType="rsaAES" w:cryptAlgorithmClass="hash" w:cryptAlgorithmType="typeAny" w:cryptAlgorithmSid="" w:cryptSpinCount="0" w:hash="" w:salt=""/>

So this rather seems as implementationError.
Comment 3 Timur 2025-04-14 09:44:48 UTC
Resolved in master 25.8+ with https://gerrit.libreoffice.org/c/core/+/184042

Adding also the commit for future search: 29c7e73d132154ef7e83b15f6ff39938fb927fe5

sw: always export enforcement attribute of documentProtection

otherwise: (in word/settings.xml)
- if a docx document has w:enforcement="0", LO will not import it. Hence, LO will not export it, too.
- this will cause a lack of enforcement attr. - which will make the docx "protected" after export from LO - in MSO Word.

Therefore, we have to import enforcement attr. even if it's value is "0".
Comment 4 Commit Notification 2025-04-15 09:05:32 UTC
Bayram Çiçek committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/89fdd81f17ac24b007bda26ce5176a5b2f65b1d7

tdf#166173: add a unittest for enforcement attribute

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Bayram Çiçek 2025-04-15 12:13:21 UTC
also ported to libreoffice-25-2 : https://gerrit.libreoffice.org/c/core/+/184205
Comment 6 Commit Notification 2025-04-21 04:43:59 UTC
Bayram Çiçek committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/7f871c4ce43a85dc3296c81453cbf828b09352a5

tdf#166173: add a unittest for enforcement attribute

It will be available in 25.2.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.