Skip to content

[Xamarin.Installer.Build.Tasks] Validate OpenJDK downloads - #13172

Merged
simonrozsival merged 3 commits into
dotnet:mainfrom
jonathanpeppers:jonathanpeppers-jdk-signature-verification
Oct 20, 2026
Merged

simonrozsival merged 3 commits into
dotnet:mainfrom
jonathanpeppers:jonathanpeppers-jdk-signature-verification

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Add signature verification to the InstallAndroidDependencies target before it extracts and installs a downloaded Microsoft OpenJDK archive. Report XA5305 and stop installation if verification fails.


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

Validation

  • dotnet-local.cmd build src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Xamarin.Android.Build.Tests.csproj --no-restore -nodeReuse:false -v quiet — passed, 0 warnings and 0 errors.
  • dotnet-local.cmd test bin\TestDebug\net10.0\Xamarin.Android.Build.Tests.dll --filter FullyQualifiedName~OpenJdkSignatureTests — passed, 51 focused tests.
  • dotnet-local.cmd test bin\TestDebug\net10.0\Xamarin.Android.Build.Tests.dll --filter "FullyQualifiedName~OpenJdkSignatureTests.PublishedMicrosoftArchive|FullyQualifiedName~OpenJdkSignatureTests.InstallMicrosoftJdk" — passed, 2 live tests.

Add signature verification to the InstallAndroidDependencies target before
it extracts and installs a downloaded Microsoft OpenJDK archive.  Report
XA5305 and stop installation if verification fails.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1896be77-dcc1-40d0-90eb-217cb8142081
Copilot AI balanced review requested due to automatic review settings October 16, 2026 20:11

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

Verification timeouts bypass XA5305, and production-path rejection needs regression coverage.

2 open findings
What changed in this PR

Adds signature verification before the Android dependency installer extracts downloaded Microsoft OpenJDK archives.

Changes:

  • Verifies signatures against a pinned signing-key hash.
  • Reports verification failures through XA5305.
  • Adds verification tests and maintenance documentation.
File Description
src/​Xamarin.Installer.Build.Tasks/​Xamarin.Installer.Common.targets Forwards verification settings.
src/​Xamarin.Installer.Build.Tasks/​Tasks/​InstallAndroidDependencies.cs Gates installation on verification.
src/​Xamarin.Installer.Build.Tasks/​README.md Documents testing and key maintenance.
src/​Xamarin.Installer.Build.Tasks/​Properties/​Resources.resx Adds the XA5305 message.
src/​Xamarin.Installer.Build.Tasks/​Properties/​Resources.Designer.cs Exposes the diagnostic resource.
src/​Xamarin.Installer.Build.Tasks/​Properties/​AssemblyInfo.cs Enables internal access for tests.
src/​Xamarin.Installer.Build.Tasks/​OpenJdkSignatureVerifier.cs Implements OpenPGP signature verification.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Xamarin.Android.Build.Tests.csproj References installer tasks.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​OpenJdkSignatureTests.cs Adds verification and installation tests.
Documentation/​docs-mobile/​TOC.yml Links XA5305 documentation.
Documentation/​docs-mobile/​messages/​xa5305.md Explains verification failures and recovery.
Documentation/​docs-mobile/​messages/​index.md Indexes XA5305.
Documentation/​docs-mobile/​building-apps/​build-targets.md Documents installation verification.
Files not reviewed (1)
  • src/Xamarin.Installer.Build.Tasks/Properties/Resources.Designer.cs: Generated file

🧠 Review effort: Balanced

Distinguish HTTP request timeouts from caller cancellation so that
verification timeouts report XA5305 instead of suggesting a change to
the installation timeout.  Preserve caller cancellation handling.

Test HTTP timeouts and caller cancellation during both signature and
public-key requests.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1896be77-dcc1-40d0-90eb-217cb8142081
@simonrozsival

Copy link
Copy Markdown
Member

/review

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Android PR Reviewer completed successfully!

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • azcliprod.blob.core.windows.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "azcliprod.blob.core.windows.net"

See Network Configuration for more information.

Generated by Android PR Reviewer for #13172

@github-actions github-actions Bot 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.

⚠️ Needs Changes — 0 errors, 1 warning.

The verifier is narrowly scoped, pins the decoded key ring, rejects weak/unsupported signature forms, preserves cancellation, bounds verification downloads, and has strong focused coverage. The remaining concern is that _SkipSignCheck suppresses authenticity verification without a warning visible in normal builds.

CI is currently red: Azure build 1638734 has one failed MSBuild Emulator Tests macOS > Tests > MSBuild+Emulator 7 shard; all build lanes and the other listed shards passed. The environment lacked Azure DevOps authentication needed to retrieve the failed job logs, so that failure could not be classified as a PR regression or flake.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • azcliprod.blob.core.windows.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "azcliprod.blob.core.windows.net"

See Network Configuration for more information.

Generated by Android PR Reviewer for #13172 · copilot · gpt56 · 134.9 AIC · ⌖ 11.2 AIC · ⊞ 26.4K
Comment /review to run again

@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 19, 2026
Log the internal signature-check bypass at high importance so it appears
at minimal build verbosity.  Keep it informational rather than a warning.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 1896be77-dcc1-40d0-90eb-217cb8142081
@simonrozsival
simonrozsival merged commit 11e7609 into dotnet:main Oct 20, 2026
41 checks passed
@simonrozsival

Copy link
Copy Markdown
Member

/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

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

git am output
$ git cherry-pick 11e7609efd999eb5e9a1019b452e441ad1e7207c

Auto-merging Documentation/docs-mobile/TOC.yml
Auto-merging Documentation/docs-mobile/building-apps/build-targets.md
Auto-merging Documentation/docs-mobile/messages/index.md
Auto-merging src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj
Auto-merging src/Xamarin.Installer.Build.Tasks/Tasks/InstallAndroidDependencies.cs
CONFLICT (content): Merge conflict in src/Xamarin.Installer.Build.Tasks/Tasks/InstallAndroidDependencies.cs
error: could not apply 11e7609ef... [Xamarin.Installer.Build.Tasks] Validate OpenJDK downloads (#13172)
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.Build.Tasks] Validate OpenJDK downloads
Using index info to reconstruct a base tree...
M	Documentation/docs-mobile/TOC.yml
M	Documentation/docs-mobile/building-apps/build-targets.md
M	Documentation/docs-mobile/messages/index.md
M	src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj
M	src/Xamarin.Installer.Build.Tasks/Tasks/InstallAndroidDependencies.cs
Falling back to patching base and 3-way merge...
Auto-merging Documentation/docs-mobile/TOC.yml
Auto-merging Documentation/docs-mobile/building-apps/build-targets.md
Auto-merging Documentation/docs-mobile/messages/index.md
Auto-merging src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj
Auto-merging src/Xamarin.Installer.Build.Tasks/Tasks/InstallAndroidDependencies.cs
CONFLICT (content): Merge conflict in src/Xamarin.Installer.Build.Tasks/Tasks/InstallAndroidDependencies.cs
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.Build.Tasks] Validate OpenJDK downloads
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 20, 2026
…13212)

Add signature verification to the `InstallAndroidDependencies` target before it extracts and installs a downloaded Microsoft OpenJDK archive. Report `XA5305` and stop installation if verification fails.

(cherry picked from commit 11e7609)

Co-authored-by: Jonathan Peppers <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 19, 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