Skip to content

Commit e1bcc61

Browse files
authored
[Windows] Add checksum validation for JDKs (#8404)
1 parent ae48752 commit e1bcc61

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
################################################################################
22
## File: Install-JavaTools.ps1
33
## Desc: Install various JDKs and java tools
4+
## Supply chain security: JDK - checksum validation
45
################################################################################
56

67
function Set-JavaPath {
@@ -64,6 +65,12 @@ function Install-JavaJDK {
6465
$downloadUrl = $asset.binary.package.link
6566
$archivePath = Start-DownloadWithRetry -Url $downloadUrl -Name $([IO.Path]::GetFileName($downloadUrl))
6667

68+
#region Supply chain security - JDK
69+
$fileHash = (Get-FileHash -Path $archivePath -Algorithm SHA256).Hash
70+
$externalHash = $asset.binary.package.checksum
71+
Use-ChecksumComparison $fileHash $externalHash
72+
#endregion
73+
6774
# 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
6875
$fullJavaVersion = $asset.version.semver -replace '\+', '-'
6976
# Create directories in toolcache path

0 commit comments

Comments
 (0)