-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension can recursively delete all system files #48
Comments
Hi @ascendedguard, Do you have a consistent repro scenario? The viewer only writes and deletes files to within the ExtensionContext's If you have a consistent repro please send it and I will create a VM and investigate this. |
Understood. I'll see if I can reproduce in a Windows Sandbox instance - I didn't reproduce it after my first time in my original laptop, it seemed to only happen when I first installed the extension, but it functioned fine afterwards. For my coworker, it seemed to also be when first launching VS Code in a new window after newly installing the extension. It was also the first and only extension he had installed immediately after installing VS Code. |
I just reproduced it very easily in Windows Sandbox. This is on a different computer than the first 2, a custom built PC running Windows 10.
I HIGHLY recommend you don't test this on your main machine, do it in a VM, since it will delete everything. |
Looking at the extension logs, they're not too helpful:
The VS Code main log isn't helpful either, although it does seem to show a file got deleted 2 seconds after the OOXML viewer logs:
|
Throw if `storageUri` is not set instead of falling back to ''. `storageUri` is undefined if no folder is open in vscode (https://vscode-api.js.org/interfaces/vscode.ExtensionContext.html#storageUri). Add an assertion in the deleteFile() utility method to ensure deletes only work on paths that include the name of the extension. Fixes #48
Hi @ascendedguard, I was able to reproduce the issue using the steps you provided. Can you check if this build fixes it for you? |
I get an error if I try to install from the .vsix. Just unzipped and selected Install from VSIX on a new VS Code install:
VS Code info: |
ooxml-viewer-2.0.2.zip |
Looks good to me 👍 |
This has happened twice now, once for me around a year ago, and twice now for a colleague as I was viewing him in a meeting.
It appears if you have the OOXML Viewer tab open, sometimes it will be working even though no file is open yet. When this happens, we both noticed all files on our desktop went missing (but not folders). Further investigation reveals that all files on the file system get deleted (no folders) recursively from the root of the
C:\
, although it tends to error out at some point so not all files get deleted, and system files like C:\Windows don't get deleted since Code would not have access to that without escalation. In my case, it deleted a good amount of C:\Users<username> folder including documents, downloads, desktop, along with all repos stored atC:\Projects\
, amongst other folders.When I looked into it about a year ago, IT used our monitoring software and did trace back the date/time when the files got deleted to be within a minute of the OOXML Viewer extension being installed in VS Code, so it probably lined up with me trying to open a file.
When watching my coworker (who is not a developer), he continued experimenting with it since he had already had his files deleted - he had no folder open yet and instead tried to open a test .docx from his desktop directly (which was incorrect, but he didn't know how to open it correctly). the test file on his desktop got deleted a second time when attempting to open it. He then opened the folder as he was supposed to but when he did, the OOXML Viewer tab disappeared from the explorer view, then we checked and the OOXML Viewer extension itself had been fully deleted and needed to be reinstalled.
Both systems were Lenovo laptops with Windows 10. The issue occurred today on the latest released version, although like I said, it happened to me around 1 year ago.
Looking through the code, I see the deleteFile section that does
{ recursive: true, trash: false }
and I can only assume there's some situation where a valid path isn't being passed in, so it must be defaulting to\
instead.The text was updated successfully, but these errors were encountered: