desktop icon indicating copy to clipboard operation
desktop copied to clipboard

Ampersand `&` character in Workspace Name breaks Workspace Menu permanently

Open floogy opened this issue 2 years ago • 9 comments

What happened?

Don't recommend you test this in your main browser, because restarting Zen does not fix it.

  1. Name a Workspace with an ampersand & in the name, e.g. Watch & Learn
  2. Notice that the Workspace Menu button stopped responding to clicks try not to panic
  3. Restart the browser and rage click on the Workspace menu until accepting the fact a restart didn't fix it.
  4. Slowly realize you need to uninstall Zen and start over.

Reproducible?

  • [X] I have checked that this issue cannot be reproduced on Mozilla Firefox.

Version

1.0.0-a.27 (64-bit)

Severity impact

Critical

What platform are you seeing the problem on?

Windows

Relevant log output

No response

floogy avatar Aug 22 '24 12:08 floogy

I've encountered that issue as well - Windows 11 23H2, Zen 1.0.0-a.27

Miccowhy avatar Aug 23 '24 12:08 Miccowhy

This somehow gets worse:

  • Add & Remove Programs > Uninstall Zen
  • Reinstall then launch Zen
  • Observe that Workspace Menu button STILL does not work

It seems the Uninstall process also has issues, since it doesn't remove all configuration settings.

What additional folders or registry entries do we need to manually remove in order to reinstall and get a working Zen Workspaces menu on the same computer that once entered an ampersand in a Workspace name?

floogy avatar Aug 23 '24 15:08 floogy

Jus try removing zen-workspaces inside the profiles directory

mr-cheffy avatar Aug 23 '24 15:08 mr-cheffy

I've encountered that issue as well - Windows 11 23H2, Zen 1.0.0-a.27

Did uninstalling and reinstalling Zen restore the Workspaces Menu button's functionality for you?

It did not for me - Windows 10, Zen 1.0.0-a.27.

floogy avatar Aug 23 '24 15:08 floogy

Jus try removing zen-workspaces inside the profiles directory

Thank you. Manual fix is to remove the ampersand & from your Workspace name in C:\Users\xxxxxx\AppData\Roaming\zen\Profiles\xxxxxxx.Default (alpha)\zen-workspaces\Workspaces.json

floogy avatar Aug 23 '24 15:08 floogy

An option to "[ ] Remove profile data" in the Uninstall wizard would enable non-technical users to start afresh and recover from issues introduced in the config without manually editing config files.

The reader can determine whether to turn this into an issue.

floogy avatar Aug 23 '24 15:08 floogy

Did some testing. When changing & to & in the Workspaces.json file, it displays & as expected.

image

You can test this by entering something like this is a & test compared to this is a & test. To recover from the issue, open the Workspaces.json file, rename the entry to something else that doesn't mention the special character &, and then relaunch the browser.

The workspace name is being passed raw to window.MozXULElement.parseXULToFragment(). While I never used that API before, I'm assuming that there was a parse error. https://github.com/zen-browser/components/blob/bbc9e79c2afa97f833762b1eb8ba61ca1fa19aac/src/ZenWorkspaces.mjs#L181,L191 This issue can also occur with other special characters (such as < [> doesn't appear to cause any issues?]).

In terms of other issues that would be present from the lack of sanitization, you can inject some HTML (not sure about JavaScript execution -- simple script tags didn't appear to work anyway). It's nothing that special or high of risk. image (Causes an issue with parsing despite being able to show the text anyway. Maybe the parsing error happened elsewhere, as there are multiple occurrences of window.MozXULElement.parseXULToFragment() that take in the workspace name.)

The likely solution would be to convert special characters to their HTML entity forms before having it be parsed as part of the UI.

uintdev avatar Aug 23 '24 17:08 uintdev

Fixed for the next release 👍🏽

mr-cheffy avatar Aug 23 '24 17:08 mr-cheffy

https://github.com/zen-browser/components/commit/e12618009eed9382598b878b735587edd220aec7

mr-cheffy avatar Aug 23 '24 17:08 mr-cheffy