0

I have an app that tests web page layouts in different browsers without requiring the user to download a new browser to their local. Every time when a user opens a new browser to test a page, I want this browser to open in a sandbox to limit the browser's actions in case of coming across any malware or dangerous sites.

How can I do that?

Note: The app is in C#.

Siraf
  • 1,133
  • 9
  • 24
BGB37
  • 1
  • 3

1 Answers1

0

You may also want to determine if this will be an acceptable workflow since each launched sandbox will only have the default browser by default. Additional browsers may have to be manually installed, even scripted, but will take time and slow down testing.

Configuring your sandbox:

You may be able to devise a workaround based on creating a .wsb file and populating it with a startup script. Your app can create this file programmatically with parameters and launch it.

https://www.windowscentral.com/how-configure-windows-sandbox-windows-10

Based on that you would probably have something like the following:

<Configuration>
<VGpu>Default</VGpu>
<Networking>Default</Networking>
<MappedFolders>
   <MappedFolder>
     <HostFolder>C:\FolderThatContainsBrowserInstaller\</HostFolder>
     <ReadOnly>false</ReadOnly>
   </MappedFolder>
</MappedFolders>
<LogonCommand>
   <Command>Powershell.exe -ExecutionPolicy Unrestricted C:\users\WDAGUtilityAccount\Desktop\FolderThatContainsBrowserInstaller\ScriptThatInstallsBrowserAndLaunchesURL.ps1</Command>
</LogonCommand>
</Configuration>

Additional info may be found here: Starting the Windows Sandbox from managed code

You will have to decide what the ScriptThatInstallsBrowserAndLaunchesURL.ps1 actually does, but installing browser to test, then launching it with URL sounds like a fairly simple task.

Anthony G.
  • 452
  • 2
  • 7