Browser updates

Techie

New member
Hi,

First of all, thanks for making Sandboxie-Plus!

I've a question regarding browser updates. What would be the best way to make sure the browser gets updated properly? I use Vivaldi but this question is also related to Firefox and Chrome.
Normally browsers auto-update themselves when starting the browser, but when running them in Sandboxie the updates don't get installed properly.
So I'm wondering if there's a way to make sure they get updated outside the Sandbox first when starting them, and then start them in the Sandbox (without having to manually disable Sandboxie, do the update, then start it in Sandboxie).

Any ideas? Thanks!
 
When there is an update, my workflow is to disable the force rules, for the browser (or globally), start the browser, which gets launched outside the control of Sandboxie, can update itself like it normally does. Once the update is applied after the browser is restarted, I close it and re-enable the force rules. Then I launch the browser, which gets started under Sandboxie's supervision.

It is possible to start a program and ignore the forced program rule like this:
Code:
"C:\Program Files\Sandboxie\Start.exe"  /dfp c:\path\to\program.exe
or
Code:
"C:\Program Files\Sandboxie\Start.exe"  /disable_force  c:\path\to\program.exe
which is the same just with the verbose string

Since browsers restart during the update process, I am not sure if they will be able to update themselves in all instances, if they are just started unsandboxed once, and then "normally" after. If someone has tested this with satisfying results, it would be nice to know.

If someone has an automated way, like a .bat or powershell script, that would also be nice to know.
 
Hi Bastik,

Thanks for your reply!
That's the way I do it as well. I didn't know about the command-line to start it without sandboxing though, that's very useful.

Perhaps there's a few options to script this using PowerShell.
If it's possible to check if a new version is available on the browsers website, and if so, start it without sandboxing to let it update and then you can close it and start it again and this time it should notice it's up to date and then start it sandboxed.
I see that the installer for Vivaldi contains the full version number, for example Vivaldi.6.1.3035.204.x64.exe so it's possible to compare that against the currently installed Vivaldi.exe file version property.
I'll check if I can make a script and post it here.
Still, this would not be fully automatic since you would need to start the browser twice in case there is an update.
 
It turns out it's quite easy to script update installations for Vivaldi since it has a separate app that can be used for automatic update installations. Here's a PowerShell script that checks for and installs updates and then starts Vivaldi sandboxed:

Code:
$scriptName = "Start Vivaldi"
$scriptVersion = "1.0"

#This script updates Vivaldi and then starts it sandboxed.

#Modify these paths to point to where Vivaldi is installed:
$vivaldiUpdateInstallerExePath = "C:\Users\Techie\AppData\Local\Vivaldi\Application\update_notifier.exe"
$vivaldiExePath = "C:\Users\Techie\AppData\Local\Vivaldi\Application\vivaldi.exe"

if(-not (Test-Path -Path $vivaldiExePath))
{
    Write-Host "Failed to find $($vivaldiUpdateInstallerExePath) (which is used for installing updates)."
    Write-Host "Press Enter to exit."
    Read-Host
    exit
}

if(-not (Test-Path -Path $vivaldiExePath))
{
    Write-Host "Failed to find $($vivaldiExePath)."
    Write-Host "Press Enter to exit."
    Read-Host
    exit
}

$sandboxieStartExePath = "C:\Program Files\Sandboxie-Plus\Start.exe"
if(-not (Test-Path -Path $sandboxieStartExePath))
{
    Write-Host "Failed to find $($sandboxieStartExePath)."
    Write-Host "Press Enter to exit."
    Read-Host
    exit
}

$currentVivaldiExeVersion = (Get-Item $vivaldiExePath).VersionInfo.FileVersion
Write-Host "Currently installed Vivaldi version: $($currentVivaldiExeVersion)"

Write-Host "Checking for updates."
Start-Process -Wait $vivaldiUpdateInstallerExePath

$newVivaldiExeVersion = (Get-Item $vivaldiExePath).VersionInfo.FileVersion
if($currentVivaldiExeVersion -ne $newVivaldiExeVersion)
{
    Write-Host "Updated Vivaldi to version $($newVivaldiExeVersion)."
    Write-Host "Press Enter to continue."
    Read-Host
}
else
{
    Write-Host "No updates found."
}

Write-Host "Starting Vivaldi sandboxed."
Start-Process $sandboxieStartExePath -ArgumentList $vivaldiExePath

Before I found the above solution I wrote another script that's not as good but I'll leave it here anyway.
This script checks for the latest version on vivaldi.com and compares it to the installed version. If there's a newer version available, it starts Vivaldi unsandboxed, informs the user to click "Restart" in Vivaldi and to close it, and finally starts it sandboxed.

Code:
$scriptName = "Start Vivaldi"
$scriptVersion = "0.5"

#This script checks if a new version of Vivaldi is available.
#If so, it starts Vivaldi outside the sandbox so it can update.
#Otherwise it will start it in the sandbox.

#Required PowerShell version: 5 (later version are not supported)

#Modify this path to point to where vivaldi.exe is installed:
$vivaldiExePath = "C:\Users\Techie\AppData\Local\Vivaldi\Application\vivaldi.exe"
if(-not (Test-Path -Path $vivaldiExePath))
{
    Write-Host "Failed to find $($vivaldiExePath)."
    Write-Host "Press Enter to exit."
    Read-Host
    exit
}

$sandboxieStartExePath = "C:\Program Files\Sandboxie-Plus\Start.exe"
if(-not (Test-Path -Path $sandboxieStartExePath))
{
    Write-Host "Failed to find $($sandboxieStartExePath)."
    Write-Host "Press Enter to exit."
    Read-Host
    exit
}

$vivaldiExeVersion = (Get-Item $vivaldiExePath).VersionInfo.FileVersion
Write-Host "Currently installed Vivaldi version: $($vivaldiExeVersion)"

$sandboxieStartExeArgumentsDisableForce = "/disable_force $($vivaldiExePath)"
$sandboxieStartExeArgumentsEnableForce = "$($vivaldiExePath)"

$vivaldiUri = "https://vivaldi.com/blog/"
try
{
    Write-Host "Checking for updates on $vivaldiUri."
    $webResponse = Invoke-WebRequest -Uri $vivaldiUri
}
catch
{
    Write-Host "Failed to check for updates."
    Write-Host "Failed to connect to $($vivaldiUri)."
    Write-Host "Error: $($PSItem)"
    Write-Host "Starting Vivaldi sandboxed."
    Start-Sleep -Seconds 4
    Start-Process $sandboxieStartExePath -ArgumentList $sandboxieStartExeArgumentsEnableForce
    exit
}

foreach($link in $webResponse.Links)
{
    if($link.href.contains("https://vivaldi.com/download/"))
    {
        $webVersion = $link.innerText -replace "Stable - ", "" -replace " \(", "." -replace "\)", ""
        if($vivaldiExeVersion -ne $webVersion)
        {
            Write-Host "A new version is available: $($webVersion)"
            Write-host "Starting Vivaldi unsandboxed to install the update."
            Write-Host "Please wait and then click on `"Restart Required`" > `"Restart`" in Vivaldi."
            Write-Host "Wait for it to restart and then close it."
            Write-Host "Press Enter to continue."
            Read-Host
            Start-Process -Wait $sandboxieStartExePath -ArgumentList $sandboxieStartExeArgumentsDisableForce
            Write-Host "Update installed."
            Write-Host "Starting Vivaldi sandboxed."
            Start-Sleep -Seconds 4
            Start-Process $sandboxieStartExePath -ArgumentList $sandboxieStartExeArgumentsEnableForce
            exit
        }
        else
        {
            Write-host "The installed version is up-to-date."
            Write-Host "Starting Vivaldi standboxed."
            Start-Process $sandboxieStartExePath -ArgumentList $sandboxieStartExeArgumentsEnableForce
            exit
        }
    }
}

Write-Host "Failed to check for updates."
Write-Host "Couldn't locate the latest version number on $($vivaldiUri)."
Write-Host "Starting Vivaldi sandboxed."
Start-Sleep -Seconds 4
Start-Process $sandboxieStartExePath -ArgumentList $sandboxieStartExeArgumentsEnableForce
 
Thank you for sharing your work.

If someone needs this for their browser, I think they can benefit from your script and modify it to their environment. They could speak up, if they need help or just mention if something fails.
 
Back
Top