Repository navigation
[Xamarin.Installer.AndroidSDK] Stop on archive checksum failures - #13204
Conversation
Reject the complete installation set when a downloaded archive fails validation. Add a private MSBuild checksum override and local regression tests. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4205b9a2-bfde-48eb-8e6f-61ac58529e94
There was a problem hiding this comment.
🟡 Changes recommended
Preflight validation rejects valid system images whose host-platform checks are intentionally bypassed during extraction.
1 open issue
What changed in this PR
This PR makes Android SDK installation stop before extraction when downloaded archives fail validation, with an explicit checksum override.
Changes:
- Reject the requested installation set when archive validation fails.
- Wire a private MSBuild checksum override with visible logging.
- Add local checksum, extraction, and override regression tests.
| File | Description |
|---|---|
| tests/Xamarin.Android.Tools.AndroidSdk-Tests/Xamarin.Android.Tools.AndroidSdk-Tests.csproj | Adds SharpZipLib for extraction tests. |
| tests/Xamarin.Android.Tools.AndroidSdk-Tests/AndroidSdkInstallerTests.cs | Tests validation, extraction, and override behavior. |
| src/Xamarin.Installer.Build.Tasks/Xamarin.Installer.Common.targets | Passes the private checksum override. |
| src/Xamarin.Installer.Build.Tasks/Tasks/InstallAndroidDependencies.cs | Configures the override and visible logging. |
| src/Xamarin.Installer.AndroidSDK/Xamarin.Installer.AndroidSDK/AndroidSDKInstaller.cs | Enforces preflight rejection and optional checksum bypass. |
Review effort: Balanced
Use the same system-image platform exception during archive validation and installation. Keep checksum verification enabled by default. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4205b9a2-bfde-48eb-8e6f-61ac58529e94
Preserve the SDK checksum override alongside the OpenJDK signature settings. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4205b9a2-bfde-48eb-8e6f-61ac58529e94
|
@dalexsoto review |
dalexsoto
left a comment
There was a problem hiding this comment.
Checksum failures now reject the requested archive set before any extraction, preserving both exception and log-and-return behavior. Both preflight checks retain the existing system-image platform exception, while the explicit checksum override stays default-off with High-importance logging and does not bypass ordinary platform or JDK validation. Source review only; no installation run is certified.
|
/backport to release/11.0.1xx |
|
Started backporting to |
|
@jonathanpeppers backporting to git am output$ git cherry-pick 000586aed6069a09e8ab5034607f2c8b18944e3e
Auto-merging src/Xamarin.Installer.AndroidSDK/Xamarin.Installer.AndroidSDK/AndroidSDKInstaller.cs
Auto-merging src/Xamarin.Installer.Build.Tasks/Tasks/InstallAndroidDependencies.cs
CONFLICT (modify/delete): tests/Xamarin.Android.Tools.AndroidSdk-Tests/AndroidSdkInstallerTests.cs deleted in HEAD and modified in 000586aed ([Xamarin.Installer.AndroidSDK] Stop on archive checksum failures (#13204)). Version 000586aed ([Xamarin.Installer.AndroidSDK] Stop on archive checksum failures (#13204)) of tests/Xamarin.Android.Tools.AndroidSdk-Tests/AndroidSdkInstallerTests.cs left in tree.
Auto-merging tests/Xamarin.Android.Tools.AndroidSdk-Tests/Xamarin.Android.Tools.AndroidSdk-Tests.csproj
error: could not apply 000586aed... [Xamarin.Installer.AndroidSDK] Stop on archive checksum failures (#13204)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: [Xamarin.Installer.AndroidSDK] Stop on archive checksum failures
Using index info to reconstruct a base tree...
M src/Xamarin.Installer.AndroidSDK/Xamarin.Installer.AndroidSDK/AndroidSDKInstaller.cs
M src/Xamarin.Installer.Build.Tasks/Tasks/InstallAndroidDependencies.cs
M src/Xamarin.Installer.Build.Tasks/Xamarin.Installer.Common.targets
A tests/Xamarin.Android.Tools.AndroidSdk-Tests/AndroidSdkInstallerTests.cs
M tests/Xamarin.Android.Tools.AndroidSdk-Tests/Xamarin.Android.Tools.AndroidSdk-Tests.csproj
Falling back to patching base and 3-way merge...
Auto-merging src/Xamarin.Installer.AndroidSDK/Xamarin.Installer.AndroidSDK/AndroidSDKInstaller.cs
Auto-merging src/Xamarin.Installer.Build.Tasks/Tasks/InstallAndroidDependencies.cs
CONFLICT (content): Merge conflict in src/Xamarin.Installer.Build.Tasks/Tasks/InstallAndroidDependencies.cs
Auto-merging src/Xamarin.Installer.Build.Tasks/Xamarin.Installer.Common.targets
CONFLICT (content): Merge conflict in src/Xamarin.Installer.Build.Tasks/Xamarin.Installer.Common.targets
CONFLICT (modify/delete): tests/Xamarin.Android.Tools.AndroidSdk-Tests/AndroidSdkInstallerTests.cs deleted in HEAD and modified in [Xamarin.Installer.AndroidSDK] Stop on archive checksum failures. Version [Xamarin.Installer.AndroidSDK] Stop on archive checksum failures of tests/Xamarin.Android.Tools.AndroidSdk-Tests/AndroidSdkInstallerTests.cs left in tree.
Auto-merging tests/Xamarin.Android.Tools.AndroidSdk-Tests/Xamarin.Android.Tools.AndroidSdk-Tests.csproj
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 [Xamarin.Installer.AndroidSDK] Stop on archive checksum failures
Error: The process '/usr/bin/git' failed with exit code 128 |
…cksum failures (#13234) Backport #13204 from 000586a. Reject all requested SDK components before extraction when a downloaded archive fails validation. Keep both error modes and the system-image host exception. Add the private checksum override and a visible notice; the override does not bypass host checks. Add the checksum regression tests as a new file on this release branch and reference the installer project. Exclude unrelated discovery tests from main. Context: #13204 Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4a41c251-5cd4-4964-8190-39c7a6bc692f

AndroidSDKInstaller.Installdetects invalid downloaded archives butdoes not set
haveArchiveIssues. Installation continues and skipschecksum verification during extraction. As a result, an archive with
an incorrect checksum can still be installed.
Set the flag when an invalid archive is found so the complete requested
set is rejected before any component is extracted. Preserve both the
existing exception mode and the error-log-and-return mode.
Add a private MSBuild override,
_AndroidIgnoreSdkArchiveChecksumErrors=true, to permit installationafter a checksum failure. It is off by default and reports continued
installation with a High importance message. Platform validation and
JDK checks remain unchanged.
Add local regression tests for SHA-1 and SHA-256, both error modes,
component order, valid installation, and the override. Reference the
installer's existing SharpZipLib version in the test project to exercise
real extraction.
Validation
dotnet test tests\Xamarin.Android.Tools.AndroidSdk-Tests\Xamarin.Android.Tools.AndroidSdk-Tests.csproj -v minimal -p:AndroidToolsDisableMultiTargeting=false -p:DotNetTargetFrameworkVersion=10.0— build succeeded; 498 passed, 16 skipped, 0 failed.dotnet test tests\Xamarin.Android.Tools.AndroidSdk-Tests\Xamarin.Android.Tools.AndroidSdk-Tests.csproj -c Release -v minimal -p:AndroidToolsDisableMultiTargeting=false -p:DotNetTargetFrameworkVersion=10.0 --filter "FullyQualifiedName~AndroidSdkInstallerTests"— build succeeded; 32 passed, 0 failed.git --no-pager diff --check— passed.Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include: