Skip to content

Commit be42f35

Browse files
authored
[Windows] Add checksum verification for Firefox browser (#8411)
1 parent 6315b7e commit be42f35

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

images/win/scripts/Installers/Install-Firefox.ps1

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
################################################################################
22
## File: Install-Firefox.ps1
33
## Desc: Install Mozilla Firefox
4+
## Supply chain security: Firefox browser - checksum validation
45
################################################################################
56

67
# Install and configure Firefox browser
78
Write-Host "Install latest Firefox browser..."
89
$VersionsManifest = Invoke-RestMethod "https://product-details.mozilla.org/1.0/firefox_versions.json"
9-
$InstallerName = "firefox-browser.exe"
1010
$InstallerUrl = "https://download.mozilla.org/?product=firefox-$($VersionsManifest.LATEST_FIREFOX_VERSION)&os=win64&lang=en-US"
11-
$ArgumentList = ("/silent", "/install")
11+
$packagePath = Start-DownloadWithRetry -Url $InstallerUrl -Name "FirefoxSetup.exe"
1212

13-
Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList
13+
#region Supply chain security - Stack
14+
$fileHash = (Get-FileHash -Path $packagePath -Algorithm SHA256).Hash
15+
$hashUrl = "https://archive.mozilla.org/pub/firefox/releases/$($VersionsManifest.LATEST_FIREFOX_VERSION)/SHA256SUMS"
16+
$externalHash = (Invoke-RestMethod -Uri $hashURL).ToString().Split("`n").Where({ $_ -ilike "*win64/en-US/Firefox Setup*exe*" }).Split(' ')[0]
17+
Use-ChecksumComparison $fileHash $externalHash
18+
#endregion
19+
20+
Install-Binary -FilePath $packagePath -ArgumentList "/silent", "/install"
1421

1522
Write-Host "Disable autoupdate..."
1623
$FirefoxDirectoryPath = Join-Path $env:ProgramFiles "Mozilla Firefox"

0 commit comments

Comments
 (0)