OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
670 stars 96 forks source link

Office document crashes when reading custom document properties after changing a sensitivity label #3555

Closed mscc-sascha closed 5 months ago

mscc-sascha commented 1 year ago

Any office application crashes when reading the custom document properties by using OfficeJS (const properties = context.document.properties.customProperties) after the assigned sensitivity label has been changed.

NOTE: I experienced the same by creating a COM-AddIn and accessing custom document properties (https://learn.microsoft.com/en-us/office/vba/api/Word.Document.CustomDocumentProperties)

Provide required information needed to triage your issue

Your Environment

Expected behavior

When changing the sensitivity label, reading the custom document properties from an AddIn (COM-AddIn and OfficeJS) should work.

Current behavior

The entire application crashes and restarts without showing any error. In Event Viewer I could find the following:

Faulting application name: WINWORD.EXE, version: 16.0.16529.20182, time stamp: 0x64a8fe68
Faulting module name: mso98win32client.dll, version: 0.0.0.0, time stamp: 0x649b9b68
Exception code: 0xc0000005
Fault offset: 0x0000000000131020
Faulting process id: 0x0x1D70
Faulting application start time: 0x0x1D9C44D4CF42D84
Faulting application path: C:\Program Files\Microsoft Office\Root\Office16\WINWORD.EXE
Faulting module path: C:\Program Files\Common Files\Microsoft Shared\Office16\mso98win32client.dll
Report Id: fe08cc1a-16b0-4fc9-b1bb-49c6bc8da6ab
Faulting package full name: 
Faulting package-relative application ID: 

Steps to reproduce

  1. Set up Microsoft Information Protection (sensitivity labels)
  2. Open a blank word document
  3. Assign a sensitivity label
  4. Read custom document properties by using OfficeJS.
  5. Change the sensitivity label
  6. Read custom properties by Using OfficeJS again The application crashes.

Link to live example(s)

  1. Public gist

Context

Currently our integrations are depending on the sensitivity labels and do not work correctly in case of changing them. Most of our customers have disabled Co-Authoring for files encrypted with sensitivity labels, therefore we want to read out the applied sensitivity labels by parsing the custom document properties.

ghost commented 1 year ago

Thank you for letting us know about this issue. We will take a look shortly. Thanks.

ZYUN-MSFT commented 1 year ago

Hi @mscc-sascha ,

We are still investigating this issue with engineer team. I will back to this thread once I get update.

Thanks.

xuruiyao-msft commented 1 year ago

@mscc-sascha Thanks for reporting this to us. Here's my steps to reproduce this issue:

  1. Open a blank word document.
  2. Home -> Sensitivity -> Confidential -> Recipients only -> change field filled with the emails -> OK
  3. Set some custom properties
  4. Change the Sensitivity to Confidential any user (No protection).
  5. Read the custom properties The word crashs.

Would you please help confirm the detailed steps to reproduce it? It can help us to figure out the root cause or workaround. Thanks.

ghost commented 1 year ago

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

ZYUN-MSFT commented 1 year ago

Hi @mscc-sascha , please help to confirm the reply from @xuruiyao-msft .

This would be help for our issue locate.

Thanks.

mscc-sascha commented 1 year ago

Hi @xuruiyao-msft

Sorry for me late reply, I was out of office for a few days! Please follow the steps to reproduce I have described above. Based on your steps, here are the corrections:

  1. Open a blank word document.
  2. Home -> Sensitivity -> Confidential
  3. Read the custom properties --> Works!
  4. Change the Sensitivity to General
  5. Read the custom properties --> The Word crashs

You can use the Code published here to read the sensitivity labels by using OfficeJS.

xuruiyao-msft commented 1 year ago

@mscc-sascha About the step 2. Which Confidential option do you choose? I notice that there are four options:

  1. Recipients only
  2. Microsoft FTE
  3. Microsoft extended
  4. Any user (no protection)

Thanks for your confirmation.

ZYUN-MSFT commented 1 year ago

Hi @xuruiyao-msft and @mscc-sascha ,

I need to clarify something there. For sensitivitay label (MIP), the detail type of them is configured by the tenant/site admin. So the user in different tenant will see different label, and that's the expected.

mscc-sascha commented 1 year ago

Hi @xuruiyao-msft

As @ZYUN-MSFT mentioned, the MIP labels are different for each environment, so it doesn't matter what label you set. I could reproduce the error with any label set (default or custom).

Please note that Co-Authoring for files encrypted with sensitivity labels should not be activated (https://learn.microsoft.com/en-us/purview/sensitivity-labels-coauthoring). If activated, labels are not stored as custom document properties anymore.

Thanks!

xuruiyao-msft commented 1 year ago

@mscc-sascha @ZYUN-MSFT Thanks for clarify the details. We've created the work item(8222053) to track this issue. If any updates, we'll sync with you.

jipyua commented 5 months ago

thanks @mscc-sascha for reproting this issue, it has been fixed and deployed to latest M365 office, please upate to the latest version and have a try. feel free to let us know if there are other issues.

mscc-sascha commented 5 months ago

@jipyua Thanks, it works now as expected!