Skip to content

Conversation

@erik-krogh
Copy link
Contributor

@erik-krogh erik-krogh commented Apr 14, 2021

Inspired by CVE-2020-7750

I've refactored the libraries to use API::Node more, and added models for the return values from more XML-parsing libraries.

A simple evaluation looks OK.

@erik-krogh erik-krogh added the no-change-note-required This PR does not need a change note label Apr 14, 2021
@github-actions github-actions bot added the JS label Apr 14, 2021
@erik-krogh erik-krogh marked this pull request as ready for review April 14, 2021 16:11
@erik-krogh erik-krogh requested a review from a team as a code owner April 14, 2021 16:11
Copy link
Contributor

@esbena esbena left a comment

Choose a reason for hiding this comment

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

LGTM.
Some minor thoughts about potential FPs in a test case.

sink(child.attr('foo').value()); // NOT OK

var child2 = xmlDoc.root().child()
sink(child2.attr('foo').name()); // NOT OK
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. This is equivalent to sink("foo"), which is safe.. But it is probably OK for us to get a FP in this silly case: why would you ever do .attr(x).name()?

A less silly variant, of this is attr.name() for a document that has been checked with a schema. But that is probably extremely rare in practice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, the example is silly, nicely spotted.
I think it's fine to keep anyway. The .name() method generally returns tainted values.

@codeql-ci codeql-ci merged commit 4be183c into github:main Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

JS no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants