[Windows] Add checksum validation for JDKs (#8404)

This commit is contained in:
Erik Bershel
2023-10-04 14:59:44 +02:00
committed by GitHub
parent ae487529f3
commit e1bcc61827

View File

@@ -1,6 +1,7 @@
################################################################################
## File: Install-JavaTools.ps1
## Desc: Install various JDKs and java tools
## Supply chain security: JDK - checksum validation
################################################################################
function Set-JavaPath {
@@ -64,6 +65,12 @@ function Install-JavaJDK {
$downloadUrl = $asset.binary.package.link
$archivePath = Start-DownloadWithRetry -Url $downloadUrl -Name $([IO.Path]::GetFileName($downloadUrl))
#region Supply chain security - JDK
$fileHash = (Get-FileHash -Path $archivePath -Algorithm SHA256).Hash
$externalHash = $asset.binary.package.checksum
Use-ChecksumComparison $fileHash $externalHash
#endregion
# We have to replace '+' sign in the version to '-' due to the issue with incorrect path in Android builds https://github.com/actions/runner-images/issues/3014
$fullJavaVersion = $asset.version.semver -replace '\+', '-'
# Create directories in toolcache path