If I were to edit files over an SSH connection, lets say either SSH'ing into the remote and editing files using Vim or using VSCode's remote development feature, are the files actually being transferred to the host machine (even if they are just being held in memory) and sent back after they have been changed? My fairly limited understanding of SSH would say that yes of course it would have to, but I haven't found anything to confirm this, maybe I am just not searching effectively. Unless there was a bunch of fancy infrastructure that had the remote rendering the files and sending those rendered buffers back to the host then it would have to just be sending the actual files because I don't think that is happening over just SSH(I think that that is what is happening with something like AWS workspaces?). This is being asked in the context of evaluating the security of editing files over SSH and having sensitive code on local machines.
It depends on the way each system uses SSH.
If you connect to a server using SSH and go to a terminal session and start vi, then the editing happens completely on the remote server. You only see a copy of the screen at your local machine.
I don't know all the details of VSCode remote development feature, but I see it creates a process on the remote machine, which acts as server for the Visual Studio Code process running on your computer. I think the server part opens the files at the remote server, and sends the contents to the editor, and vice versa.
Neither of these approaches sends the physical file to the client computer.
Another approach is used by desktop SFTP clients. They might have an option: "Edit file". In this case, the SFTP client downloads the file content to local disk and then starts the chosen editor to edit file on local disk.
Once the editor is closed, the SFTP client uploads the file to remote server.
And one more approach is full desktop remote access, for example VNC over SSH tunnel. In this case the graphical desktop from remote computer is shown at local computer. When you edit files there, all file operations happen at the remote server.