Ampersand `&` character in Workspace Name breaks Workspace Menu permanently
What happened?
Don't recommend you test this in your main browser, because restarting Zen does not fix it.
- Name a Workspace with an ampersand
&in the name, e.g.Watch & Learn - Notice that the Workspace Menu button stopped responding to clicks try not to panic
- Restart the browser and rage click on the Workspace menu until accepting the fact a restart didn't fix it.
- 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
I've encountered that issue as well - Windows 11 23H2, Zen 1.0.0-a.27
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?
Jus try removing zen-workspaces inside the profiles directory
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.
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
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.
Did some testing. When changing & to & in the Workspaces.json file, it displays & as expected.
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.
(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.
Fixed for the next release 👍🏽
https://github.com/zen-browser/components/commit/e12618009eed9382598b878b735587edd220aec7