Skip to content

Commit 2e47a88

Browse files
[windows] implement Android SDK cmdtools checksum (#8357)
1 parent 31a0558 commit 2e47a88

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
################################################################################
22
## File: Install-AndroidSDK.ps1
33
## Desc: Install and update Android SDK and tools
4+
## Supply chain security: checksum validation
45
################################################################################
56

67
# get packages to install from the toolset
78
$androidToolset = (Get-ToolsetContent).android
89
# Newer version(s) require Java 11 by default
910
# See https://github.com/actions/runner-images/issues/6960
10-
$cmdlineToolsUrl = "https://dl.google.com/android/repository/commandlinetools-win-9123335_latest.zip"
11+
$cmdlineToolsUrl = $androidToolset.commandline_tools_url
1112
$cmdlineToolsArchPath = Start-DownloadWithRetry -Url $cmdlineToolsUrl -Name "cmdline-tools.zip"
13+
14+
#region Supply chain security
15+
$localFileHash = (Get-FileHash -Path $cmdlineToolsArchPath -Algorithm SHA256).Hash
16+
17+
Use-ChecksumComparison -LocalFileHash $localFileHash -DistributorFileHash $androidToolset.hash
18+
#endregion
19+
1220
$sdkInstallRoot = "C:\Program Files (x86)\Android\android-sdk"
1321
$sdkRoot = "C:\Android\android-sdk"
1422
Extract-7Zip -Path $cmdlineToolsArchPath -DestinationPath "${sdkInstallRoot}\cmdline-tools"

images/win/toolsets/toolset-2019.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@
148148
"versions": [ "8", "11", "17" ]
149149
},
150150
"android": {
151+
"commandline_tools_url": "https://dl.google.com/android/repository/commandlinetools-win-9123335_latest.zip",
152+
"hash": "8A90E6A3DEB2FA13229B2E335EFD07687DCC8A55A3C544DA9F40B41404993E7D",
151153
"platform_min_version": "19",
152154
"build_tools_min_version": "19.1.0",
153155
"extra_list": [

images/win/toolsets/toolset-2022.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@
132132
"versions": [ "8", "11", "17" ]
133133
},
134134
"android": {
135+
"commandline_tools_url": "https://dl.google.com/android/repository/commandlinetools-win-9123335_latest.zip",
136+
"hash": "8A90E6A3DEB2FA13229B2E335EFD07687DCC8A55A3C544DA9F40B41404993E7D",
135137
"platform_min_version": "27",
136138
"build_tools_min_version": "27.0.0",
137139
"extra_list": [

0 commit comments

Comments
 (0)