Local files deletion and bugs, more bugs and potential security flaws

Discuss SolidWorks PDM
User avatar
mp3-250
Posts: 637
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 712
x 348

Local files deletion and bugs, more bugs and potential security flaws

Unread post by mp3-250 »

I am trying to facilitate the search and removal of local files from the user vault view.
The point is to remove greyed out folder and the remains of cached files that were moved in another folder or renamed by another PDM client. I would like to make some quick link to unique folder paths containing local only files to allow the user a quick deletion.

In our test server I added the "local file search" to the RMB menu, launch the search and the local file list to add to the vault is shown. Until here everything is ok.

Since I want to delete the data in the local file search dialog, I export the file list as csv and open it in excel. It opens ok.

To speed up the deletion of local files I made an hyperlink out of the list path for each file with =HYPERLINK(CELL) in the column next to the path exported from PDM. The link to the folder is created, but it opens as a normal folder not a PDM one.

If you log off from PDM you can jump into the local cache bypassing the login screen and tamper with your local vault view files... Those links work as intended if you use =HYPERLINK(CELL)&"\" appending a backslash at the end of the exported path.

Another way to access the local vault view raw files needs to simply append a "/" (slash without quotes) at the end of your path in the PDM explorer: all the folders turn gray and the local data is visible again...from the PDM explorer interface. (Check in and check out are greyed out) At least this one still requires login to see the folder content. (It works on a Japanese localized OS at least, it does not work on the root folder of the vault)

In this mode you cannot see which file is local only or a checked in file cache or a private status one, so you could end up deleting everything and not only local files.

I already knew that using a file manager like totalcommander or similar, and the command prompt you could access the local vault view in "raw mode", but I think it is a bit complicated for the average user, while a mistype or a simple command in excel would allow a plausible deniability for potential malicious intent.

I am trying to understand what can be done if the local cache is altered. In theory not much.

Deleting cached files (already checked in) seems to delete only the local cache on the PDM client.
This is expected behaviour and it is not a concern.
Same for folder, every folder inside the vault could be deleted as it is shown as grey, but the server seem smart enought to delete only the local cache of the client and not the server side.

Deleting a checked out file make deleted in the recycle bin by default, the database still see the file inside the folder when opening explorer in pdm mode, but checkin is not possible as no local file is present. This could potentially lead to data loss depending on how the file is deleted.

Copy and pasting some random data renamed as SLDPRT and overwriting a checkout file local cache, will not allow check in. Removing the read only flag and editing the file makes it a newer file version even without edit rights, but no check in is possible.

Other ideas on what to check? Or potential risks of tampering with a local cache?
User avatar
mp3-250
Posts: 637
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 712
x 348

Re: Local files deletion and bugs, more bugs and potential security flaws

Unread post by mp3-250 »

QUESTION
Is it possible to use commands such as ‘move’, ‘mkdir’, ‘copy’, and ‘del’ from the Windows® command prompt with files in a SOLIDWORKS® PDM vault view?
ANSWER
No. It is a best practice to avoid manipulating vault views from the Windows® command prompt.

The SOLIDWORKS® PDM vault view runs as a namespace extension in Windows File Explorer. The view relies on Windows API's to manage files. Commands from the command prompt only manipulate the locally cached files. For example, you cannot use the ‘move’ command to move a file in the vault. Instead, the ‘move’ command moves only the local copy. The file remains in the vault and vault view and will recache the next time. To update the vault, you can SOLIDWORKS PDM API commands if planning to use some command-line tool.

The ‘del’ command deletes only the local copy. The file remains in the vault.

The ‘copy’ command creates a new local copy. However, the command might not add the new copy to the vault automatically. This happens if the file extension is not part of the user settings, adding files list.

The ‘mkdir’ command does the same. That is, the command creates a local folder unless the folder name is part of the user settings, adding folders list.

Add those local files or folders afterward from File Explorer by right clicking the file and choosing the ‘Add to vault’ option. This assumes that the logged in user can see the local files.

S-049935,1-S33OTQ
QA Article: QA00000109916

As a hint even command prompt monipulates only the local cached data as expected.
rodface
Posts: 38
Joined: Fri Feb 11, 2022 11:49 am
Answers: 0
x 2
x 14

Re: Local files deletion and bugs, more bugs and potential security flaws

Unread post by rodface »

This is some interesting testing. I had no idea about the \ appending to the path allowing you to view local even with PDM running, I will need to test that.

I am not sure that there is any way that activity performed directly on the vault view folder is capable of causing the server to lose data. The OS/Filesystem is not capable of issuing the relevant SQL commands to the system that would cause an actual delete operation, etc. From that SPR you linked, it seems that the EDMserver app will simply not respond to the Del command sent from command prompt... but it Does respond to the Delete key that the user hits, so that seems like they are simply listening only to inputs that come in via Explorer.exe.

So how would I maliciously delete files? Assuming that the file vault is set to automatic login, perhaps it is possible to bring up an explorer window, move it offscreen, send keystrokes that navigate to a file, send Delete, hit Enter, etc. etc. I don't think PDM could do anything about that. But if somebody has managed to run arbitrary executables on the user machine, you have already been p0wn3d and the battle is lost.
User avatar
mp3-250
Posts: 637
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 712
x 348

Re: Local files deletion and bugs, more bugs and potential security flaws

Unread post by mp3-250 »

By the way the / Works even in the middle of a path not just at its end.

My fear, with PDM is that bugs are always around the corner and I also need to clean up the users vaults toget rid of local files and gray folders. but I am not yet in the condition to make them delete their whole local cache yet, so I want to delete at least some safe folder with templates and other basic stuff during the next deployment of 2023 using a batch on their local folders.
at this point I think just avoiding to involve explorer.exe should be safe enough
Post Reply