Skip to content

Fix missing XML validation false positives - #410

Merged
Mathias Vorreiter Pedersen (MathiasVP) merged 2 commits into
mainfrom
missing-xml-fp-fix
Nov 16, 2026
Merged

Mathias Vorreiter Pedersen (MathiasVP) merged 2 commits into
mainfrom
missing-xml-fp-fix

Conversation

@chanel-y

@chanel-y Chanel (chanel-y) commented Nov 10, 2026 •

Copy link
Copy Markdown

Change 1 - Recognize schema validation in XML reader settings initializers

For example:

var settings = new XmlReaderSettings
{
    ValidationType = ValidationType.Schema
};
settings.Schemas.Add("urn:my-schema", "my.xsd");
XmlReader.Create(new StringReader(xml), settings);

was still being flagged because it was in an object initializer

2 - exclude Stream.Null from tainted XML inputs.

Port of Raul's initial query fix, okta just hates him so doing it on his behalf

Recognize schema validation in XML reader settings initializers and exclude Stream.Null from tainted XML inputs. Add regression cases for unsafe settings mutations and fix missing source annotations in the supplied tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 490de35b-0565-4725-9bcb-f1f383e3f2f1

@MathiasVP Mathias Vorreiter Pedersen (MathiasVP) left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! The changes dont look too scary, but it would have been a lot easier to review if the PR had been of the usual form:

  1. Add tests (with false positive)
  2. Fix query
  3. Accept test changes

@MathiasVP
Mathias Vorreiter Pedersen (MathiasVP) merged commit b271303 into main Nov 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants