Skip to content

Commit e1ac652

Browse files
authored
[Windows] Add checksum verification for Kotlin (#8318)
1 parent 6cc56ba commit e1ac652

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
################################################################################
22
## File: Install-Kotlin.ps1
33
## Desc: Install Kotlin
4+
## Supply chain security: Kotlin - checksum validation
45
################################################################################
56

67
# Install Kotlin
@@ -10,11 +11,17 @@ $kotlinBinaryName = (Get-ToolsetContent).kotlin.binary_name
1011
$kotlinDownloadUrl = Get-GitHubPackageDownloadUrl -RepoOwner "JetBrains" -RepoName "kotlin" -BinaryName $kotlinBinaryName -Version $kotlinVersion -UrlFilter "*{BinaryName}-{Version}.zip"
1112
$kotlinInstallerPath = Start-DownloadWithRetry -Url $kotlinDownloadUrl -Name "$kotlinBinaryName.zip"
1213

14+
#region Supply chain security
15+
$fileHash = (Get-FileHash -Path $kotlinInstallerPath -Algorithm SHA256).Hash
16+
$externalHash = Get-HashFromGitHubReleaseBody -RepoOwner "JetBrains" -RepoName "kotlin" -FileName "$kotlinBinaryName" -Version $kotlinVersion -WordNumber 2
17+
Use-ChecksumComparison $fileHash $externalHash
18+
#endregion
19+
1320
Write-Host "Expand Kotlin archive"
1421
$kotlinPath = "C:\tools"
1522
Extract-7Zip -Path $kotlinInstallerPath -DestinationPath $kotlinPath
1623

1724
# Add to PATH
1825
Add-MachinePathItem "$kotlinPath\kotlinc\bin"
1926

20-
Invoke-PesterTests -TestFile "Tools" -TestName "Kotlin"
27+
Invoke-PesterTests -TestFile "Tools" -TestName "Kotlin"

0 commit comments

Comments
 (0)