-
Notifications
You must be signed in to change notification settings - Fork 569
[Build] Block insecure HTTP Maven repository URLs for defense in depth #11351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
simonrozsival
merged 4 commits into
main
from
jonathanpeppers/maven-require-allowinsecurehttp
May 16, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
edcb598
Block insecure HTTP Maven repository URLs unless AllowInsecureHttp is…
jonathanpeppers 5988eee
Merge main and renumber XA4251 -> XA4252 to resolve conflict
jonathanpeppers 280ad0c
Merge branch 'main' into jonathanpeppers/maven-require-allowinsecurehttp
jonathanpeppers 6bc6fb8
Address code review feedback
jonathanpeppers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| --- | ||
| title: .NET for Android error XA4252 | ||
| description: XA4252 error code | ||
| ms.date: 05/15/2026 | ||
| f1_keywords: | ||
| - "XA4252" | ||
| --- | ||
|
|
||
| # .NET for Android error XA4252 | ||
|
|
||
| ## Example message | ||
|
|
||
| ``` | ||
| error XA4252: Insecure HTTP Maven repository URL 'http://repo.example.com/maven2/' is not allowed. Use an HTTPS URL, or set AllowInsecureHttp="true" metadata on the item to override this check. | ||
| ``` | ||
|
|
||
| ## Issue | ||
|
|
||
| An `<AndroidMavenLibrary>` item specifies a Maven repository URL using `http://` instead of `https://`. | ||
| Downloading artifacts over plain HTTP is a security risk because the connection is not encrypted and is | ||
| vulnerable to man-in-the-middle attacks and supply-chain compromise. | ||
|
|
||
| This check aligns with default behavior in Gradle (`allowInsecureProtocol`) and Maven (`<blocked>http://*</blocked>`) | ||
| for defense in depth and supply-chain hardening. | ||
|
|
||
| ## Solution | ||
|
|
||
| Use an HTTPS URL for the Maven repository whenever possible: | ||
|
|
||
| ```xml | ||
| <ItemGroup> | ||
| <AndroidMavenLibrary Include="com.example:mylib" Version="1.0.0" Repository="https://repo.example.com/maven2/" /> | ||
| </ItemGroup> | ||
| ``` | ||
|
|
||
| If the repository does not support HTTPS and you understand the security implications, | ||
| set `AllowInsecureHttp="true"` to explicitly opt in to insecure HTTP: | ||
|
|
||
| ```xml | ||
| <ItemGroup> | ||
| <AndroidMavenLibrary Include="com.example:mylib" Version="1.0.0" Repository="http://repo.example.com/maven2/" AllowInsecureHttp="true" /> | ||
| </ItemGroup> | ||
| ``` |
9 changes: 9 additions & 0 deletions
9
src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.