Skip to content

[Xamarin.Installer.AndroidSDK] Stop on archive checksum failures - #13204

Merged
jonathanpeppers merged 3 commits into
mainfrom
jonathanpeppers-android-checksum-rejection
Oct 21, 2026
Merged

jonathanpeppers merged 3 commits into
mainfrom
jonathanpeppers-android-checksum-rejection

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

AndroidSDKInstaller.Install detects invalid downloaded archives but
does not set haveArchiveIssues. Installation continues and skips
checksum 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 installation
after 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.md workflow documentation, and in particular should include:

  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests

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
Copilot AI balanced review requested due to automatic review settings October 19, 2026 18:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Oct 21, 2026
@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jonathanpeppers
jonathanpeppers merged commit 000586a into main Oct 21, 2026
41 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-android-checksum-rejection branch October 21, 2026 21:35
@jonathanpeppers

Copy link
Copy Markdown
Member Author

/backport to release/11.0.1xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

@jonathanpeppers backporting to release/11.0.1xx failed, the patch most likely resulted in conflicts. Please backport manually!

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

Link to workflow output

jonathanpeppers added a commit that referenced this pull request Oct 22, 2026
…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
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants