Skip to content
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

file change notifications for files outside the sandbox does not work #3438

Open
mitchcapper opened this issue Nov 17, 2023 · 0 comments
Open
Labels
ToDo To be done

Comments

@mitchcapper
Copy link
Contributor

mitchcapper commented Nov 17, 2023

I think this is probably a known limitation but using File system change events / FindFirstChangeNotification fails to notify about files in a folder that are not created/written by the sandbox itself.

https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstchangenotificationa
https://learn.microsoft.com/en-us/dotnet/api/system.io.filesystemwatcher?view=net-7.0

if you have c:\temp\test
and it has bob.txt on the host, if the sandbox watches the c:\temp\test folder it won't get any notifications when bob changes (as its listener is likely just silently attached to the redirected folder). One can likely force pass the folder through or hardlink the original target to the sandboxed directory but wanted to document it all the same.

Any software that uses the monitoring API will miss changes to files not made to the sandboxed overlay folder directly.

I doubt a sample is needed but here is a powershell script that can take a path to monitor and will notify when changes are made.

param ($Path)

	$watcher = New-Object -TypeName IO.FileSystemWatcher -ArgumentList $Path, '*' -Property @{
		IncludeSubdirectories = $false
		NotifyFilter = [IO.NotifyFilters]::LastWrite
	  }
	try
	{
		Write-Warning "FileSystemWatcher is monitoring $Path"
		do
		{
			$result = $watcher.WaitForChanged([System.IO.WatcherChangeTypes]::Changed, 1000)
			if ($result.TimedOut) { continue }
			Write-Host File Changed: ($result | Format-Table | Out-String)
		}
	  	while ($true)
	}
	finally
	{
	  # release the watcher and free its memory:
	  $watcher.Dispose()
	  Write-Warning 'FileSystemWatcher removed.'
	}  

Confirmed passing the folder writes through thus not creating the sandboxed version with OpenPipePath= will resolve this.

@isaak654 isaak654 transferred this issue from sandboxie-plus/sandboxie-docs Nov 17, 2023
@DavidXanatos DavidXanatos added the ToDo To be done label Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ToDo To be done
Projects
None yet
Development

No branches or pull requests

2 participants