Skip to content

JS: better support for forms in js/xss-through-dom #4774

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
merged 2 commits into from
Jan 12, 2021

Conversation

erik-krogh
Copy link
Contributor

@erik-krogh erik-krogh commented Dec 3, 2020

Gets a TP/TN for CVE-2018-8035

We must have lost the TP with f23c603.
And this is my attempt at recognizing the source again.

@github-actions github-actions bot added the JS label Dec 3, 2020
@erik-krogh erik-krogh marked this pull request as ready for review December 14, 2020 13:17
@erik-krogh erik-krogh requested a review from a team as a code owner December 14, 2020 13:17
result = read
|
read.mayHavePropertyName(_) and
not read.mayHavePropertyName(getADomPropertyName())
Copy link
Contributor

Choose a reason for hiding this comment

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

With the addition of this rule it seems we now consider all properties of document to be DOM value sources.

Maybe we should just express that in a more direct way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you suggesting that I put documentRef().getAPropertyRead(any(string s | not s = getADomPropertyName())) into DefaultRange?

I'm also using the forms predicate further down, so I would also like to keep the prop-read inside the forms predicate.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just saying that all of documentRef().getAPropertyRead() is now a DOM value source, but it's done in a very non-obvious, roundabout way, by unioning three sets:

  • all prop reads with a DOM property name
  • all prop reads with a non-DOM property name, and
  • all property reads with an unknown property name.

If we end up with all of them anyway, I'd just prefer to have documentRef().getAPropertyRead() be listed as an explicit case in DefaultRange. It's fine to keep the forms() predicate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

documentRef().getAPropertyRead() is now a DOM value source

Hmmm. That turns out not to be the case.
I tried to add documentRef().getAPropertyRead(), but then the tests failed because document.location became a domValueRef.

domValueRef() does not contain documentRef(), so the property-read near the top of DefaultRange' does not refer to document`.

Copy link
Contributor

@asgerf asgerf left a comment

Choose a reason for hiding this comment

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

Ok, LGTM then. Can you run a quick evaluation?

@erik-krogh
Copy link
Contributor Author

Ok, LGTM then. Can you run a quick evaluation?

smoke-test looks ok.

@codeql-ci codeql-ci merged commit 1c8547c into github:main Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants