System.Xml: XSD allows patterns that should be invalid
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
Start by tracing how System.Xml validates xs:pattern values and how its regex handling differs from the XML regex dialect described in the linked specification. The report provides two reproductions involving grouping and backreferences; use them to identify the relevant validation tests and confirm the expected schema errors. Done means those patterns are rejected while valid XML regex patterns continue to work.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
XSD schemas allows use of regex string that are not valid according to the XML regex dialect but are valid in .NET regex dialect. Some examples include:
- Backtracking
- Various grouping constructs
- Look arounds
Reproduction Steps
using System;
using System.IO;
using System.Xml;
using System.Xml.Schema;
Check("(?<x>y)", "<id>y</id>"); // '?' should not be allowed to follow '('. Instead this creates a named group.
Check("(y)\\2", "<id>yy</id>"); // "\\2" should be an invalid escape sequence. Instead this creates a back reference
static void Check(string pattern, string xml)
{
string xsd = $@"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name='id'>
<xs:simpleType>
<xs:restriction base='xs:string'>
<xs:pattern value='{pattern}'/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>";
var settings = new XmlReaderSettings
{
ValidationType = ValidationType.Schema
};
settings.Schemas.Add(null, XmlReader.Create(new StringReader(xsd)));
int errors = 0;
settings.ValidationEventHandler += (_, e) =>
{
if (e.Severity == XmlSeverityType.Error)
errors++;
else
throw e.Exception;
};
using var reader = XmlReader.Create(new StringReader(xml), settings);
while (reader.Read()) { }
Console.WriteLine(
$"{pattern,-12} {xml,-36} {(errors == 0 ? "VALID" : "INVALID")}");
}
Expected behavior
Exceptions or output INVALID for all three since the patterns are not valid according to xml spec?
Actual behavior
Both checks outputs VALID.
Regression?
Not what i can find
Known Workarounds
No response
Configuration
No response
Other information
System.Xml has contribution bar "". I would expect these issues to be classified as edge-cased and the bug report to closed as won't fix, but at least it is logged.
- Lenguaje dominante
- C#
- Estrellas
- 18.4k
- Forks
- 5.8k
- Merge medio
- 2 d 14 h
- PR fusionados (30 d)
- 585
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotnet/runtime
-
.NET 10 single-file publishing silently produces empty executables above 2 GiB due to integer overflow in BinaryUtils.WriteToStreamPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoarea-Host untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
dotnet/runtime#137187 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
ImmutableSortedSet<T>.Builder: enumerating through IEnumerable<T> doesn't throw on modification and can return wrong itemsPosiblemente ocupada @aw0lid la tomó hace 1 día. Abiertoarea-System.Collections
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/runtime#137167 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
DbTransaction.SupportsSavepoints docs say Release/ReleaseAsync are expected to throw, but they are no-ops by designPosiblemente ocupada @alaricd la tomó hace 5 días. Abiertoarea-System.Transactions untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
dotnet/runtime#137040 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
FileSystemGlobbing: Matcher throws ArgumentOutOfRangeException when the rootDir is the same value as the filePosiblemente ocupada @makazeu la tomó hace 5 días. Abiertoarea-Extensions-FileSystem
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/runtime#136989 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Configuration binder source generator emits unqualified List<T> when binding arrays without implicit usingsPosiblemente ocupada @makazeu la tomó hace 5 días. Abiertoarea-Extensions-Configuration bug source-generator
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/runtime#136972 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de dotnet/runtime
Issues similares
-
SkillsAbiertowayfinder:grilling
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
DigiBanks99/lopen#37 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
sebastienros/fluid#1273 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
[Feature]: Add Ukrainian (Українська) as a target language for the Translator (Ollama) engineAbiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
KnifeLemon/Filee#1344 ·
Los mantenedores suelen responder en 1 día