Skip to content

[X] Protect some xmlns #28909

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

StephaneDelcroix
Copy link
Contributor

@StephaneDelcroix StephaneDelcroix commented Apr 10, 2025

Description of Change

[X] Protect some xmlns

protect maui and x: xmlns from overloading.

Issues Fixed

@Copilot Copilot bot review requested due to automatic review settings April 10, 2025 11:52
@StephaneDelcroix StephaneDelcroix requested a review from a team as a code owner April 10, 2025 11:52
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

@@ -336,16 +336,24 @@ static IValueNode GetValueNode(object value, XmlReader reader)
static void GatherXmlnsDefinitionAttributes()
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
s_xmlnsDefinitions = new List<XmlnsDefinitionAttribute>();
s_xmlnsDefinitions = [];
Copy link
Preview

Copilot AI Apr 10, 2025

Choose a reason for hiding this comment

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

Using [] to initialize s_xmlnsDefinitions is not valid in C#. Please replace it with a proper List initialization, e.g., 'new List();'.

Suggested change
s_xmlnsDefinitions = [];
s_xmlnsDefinitions = new List<XmlnsDefinitionAttribute>();

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Copy link
Member

Choose a reason for hiding this comment

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

Try the latest c# Mr AI

protect maui and x: xmlns from overloading.

- fixes #28836
@StephaneDelcroix StephaneDelcroix force-pushed the dev/stdelc/protectxmlns branch from ddcb498 to 6613043 Compare April 10, 2025 13:45
@mattleibow
Copy link
Member

😉

@@ -26,14 +27,24 @@ static IList<XmlnsDefinitionAttribute> GatherXmlnsDefinitionAttributes(ModuleDef
if (ca.AttributeType.FullName == typeof(XmlnsDefinitionAttribute).FullName)
{
var attr = GetXmlnsDefinition(ca, asmDef);
//maui, and x: xmlns are protected
if (attr.XmlNamespace.StartsWith("http://schemas.microsoft.com/", StringComparison.OrdinalIgnoreCase) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Would using https:// instead of http:// allow me to bypass this check?

I'm not exactly sure if this is supposed to be a hard check or a soft check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-xaml XAML, CSS, Triggers, Behaviors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

protect maui xmlns from overloading
4 participants